Commit c04f3e09 by Ned Batchelder

Test that the sandbox can't get to the network.

parent 9dbfca12
...@@ -96,6 +96,18 @@ class TestLimits(JailPyHelpers, unittest.TestCase): ...@@ -96,6 +96,18 @@ class TestLimits(JailPyHelpers, unittest.TestCase):
self.assertEqual(res.stdout, "Trying\n") self.assertEqual(res.stdout, "Trying\n")
self.assertIn("ermission denied", res.stderr) self.assertIn("ermission denied", res.stderr)
def test_cant_use_network(self):
res = jailpy(dedent("""\
import urllib
print "Reading google"
u = urllib.urlopen("http://google.com")
google = u.read()
print len(google)
"""))
self.assertNotEqual(res.status, 0)
self.assertEqual(res.stdout, "Reading google\n")
self.assertIn("IOError", res.stderr)
# TODO: write files # TODO: write files
# TODO: read network # TODO: read network
# TODO: fork # TODO: fork
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment