Skip to content

Commit

Permalink
Standard i/o fields blocked.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raynes committed Oct 31, 2011
1 parent 3d6d07c commit f9309dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/clojail/testers.clj
Expand Up @@ -13,7 +13,7 @@
'*read-eval* clojure.lang.Ref clojure.lang.Reflector 'ns-publics
'ns-unmap 'set! 'ns-map 'ns-interns 'the-ns clojure.lang.Namespace
'push-thread-bindings 'pop-thread-bindings 'future-call 'agent 'send
'send-off 'pmap 'pcalls 'pvals 'in-ns
'send-off 'pmap 'pcalls 'pvals 'in-ns 'System/out 'System/in 'System/err
(p "java.lang.reflect")
(p "java.util.concurrent")
(p "java.awt")})
Expand Down
5 changes: 3 additions & 2 deletions test/clojail/core_test.clj
Expand Up @@ -86,5 +86,6 @@
(is (= "foo\n" (sb '(slurp "test/test.txt"))))))

(deftest block-fields-test
(let [sb (sandbox (into secure-tester #{'System/out}))]
(is (thrown-with-msg? SecurityException #"is bad!" (sb '(. System/out println "foo"))))))
(let [sb (sandbox secure-tester)]
(doseq [field '[System/out System/in System/in]]
(is (thrown-with-msg? SecurityException #"is bad!" (sb `(. ~field println "foo")))))))

0 comments on commit f9309dc

Please sign in to comment.