Permalink
Browse files

Safe eval

  • Loading branch information...
1 parent 3789a09 commit 7be1dcafcf36f96aabb555ceb96bfcf3a4637ce6 @trentm trentm committed with Mar 30, 2012
Showing with 2 additions and 3 deletions.
  1. +2 −3 gyp-reader.js
View
@@ -2,10 +2,9 @@
module.exports = gr
var spawn = require("child_process").spawn
-, pyprog = "import sys;"
+, pyprog = "import sys, ast, json;"
+ "c = open(sys.argv[1]).read();"
- + "d = eval(c);"
- + "import json;"
+ + "d = ast.literal_eval(c);"
+ "print json.dumps(d)"
, StringDecoder = require("string_decoder").StringDecoder

0 comments on commit 7be1dca

Please sign in to comment.