safely parsing maps in clojure -
I'm looking for an easy and secure way to parse a map, and only a map, untrusted source maps Contains keywords and numbers, What are the security concerns of using the to read
?
read
is completely insecure by default, this arbitrary code execution allows for. Try (for example "print-string \" hello \ ")")
.
You can secure it by binding * read-eval *
if any # =
signaling is used on the wrong An exception will start, for example:
(binding [* reading-aval * false] (read-string "# = (println \" hello \ ")"))
Finally, supplying a large number of keywords (: foo,: bar), depending on how you are using it, is potentially a disapproval of service attack. The keywords are closed and never free; if enough use is done, then this process will be out of memory, on the closing-dev list.
Comments
Post a Comment