Implement managed browser security, individual agents and observability
This commit is contained in:
1 parent
ff482ebe23
commit
ea448de2d4
172 files changed
+5404
-347
No files matched your search
@@ -172,4 +172,15 @@ print(json.dumps(result))
|
||||
with self.assertRaises(SandboxError):self.sandbox.run(sys.executable,['-c','print("x"*10000)'],max_output=100)
|
||||
|
||||
|
||||
def test_real_compressed_office_macro_inside_sandbox(self):
|
||||
from test_office_macros import fixture, office, policy
|
||||
for source, expected in [('rule source_marker { strings: $m = "Hello from Python!" condition: $m }', 'block'), ('rule no_match { condition: false }', 'allow')]:
|
||||
request={'route':'/scan-download','data':base64.b64encode(office(fixture())).decode(),'policy':policy(source)}
|
||||
code, output=self.sandbox.run(sys.executable,[str(self.source/'sandbox_worker.py')],json.dumps(request).encode())
|
||||
self.assertEqual(code,0,output.decode(errors='replace'))
|
||||
result=json.loads(output);self.assertEqual(result['decision'],expected)
|
||||
self.assertEqual(result['officeMacros']['modules'],5)
|
||||
self.assertNotIn('Hello from Python!',output.decode())
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in new issue
Block a user