News for hackers. Stuff that matters.
Re:Clojure's Default Reader is Unsafe by puredanger on Friday March 08, 2013 @10:46AM (#5344002)
I think this is an excellent write-up of the state of the world with Clojure 1.5: http://clojuredocs.org/clojure_core/clojure.core/read

In short, don't use read-eval at all if you want safe reading. Use the clojure.edn alternatives to read data safely in those circumstances.

Re:Clojure's Default Reader is Unsafe by jfb on Friday March 08, 2013 @10:57AM (#5344069)
In addition, I was very happy to see it presented as valid Clojure with explicating commentary, rather than as an information-light "screencast".
Re:Clojure's Default Reader is Unsafe by willismichael on Friday March 08, 2013 @11:35AM (#5344285)

  ;; The particular issue of executing arbitrary Java constructors used
  ;; in the examples above no longer works in Clojure 1.5 when
  ;; *read-eval* is false.  Even so, you SHOULD NEVER USE
  ;; clojure.core/read or clojure.core/read-string for reading untrusted
  ;; data.  Use an edn reader or a different data serialization format.
From that comment it seems like the Java constructor loophole has been closed. With that gone, I don't understand why the reader is still dangerous. What am I missing?
Re:Clojure's Default Reader is Unsafe by mjw on Friday March 08, 2013 @05:15PM (#5346086)
I was wondering this too, and deliberately tried to break something using the clojure 1.5 reader with read-eval false. (Makes a change from building things all day!).

Result:

    user=> (binding [*read-eval* false] (read-string "``````````x"))
    OutOfMemoryError Java heap space  clojure.lang.RT.cons (RT.java:570)
Re:Clojure's Default Reader is Unsafe by bjeanes on Friday March 08, 2013 @06:57PM (#5346563)
There's a huge IRC log that explains the reasoning here. Mostly, it comes down to: you can't trust that libraries haven't changed read-eval back, which means that now instead of being assured that a certain fn can never be harmful, you would need to audit all libraries you use. It's the assumption itself (that read and read-string are safe) what makes it unsafe...