diff --git a/docs/tutorials/github-sandbox.md b/docs/tutorials/github-sandbox.md index bb134a812..1fcb653ba 100644 --- a/docs/tutorials/github-sandbox.md +++ b/docs/tutorials/github-sandbox.md @@ -312,9 +312,7 @@ network_policies: - { path: /sandbox/.venv/bin/python } - { path: /sandbox/.venv/bin/python3 } - { path: /sandbox/.venv/bin/pip } - - { path: /app/.venv/bin/python } - - { path: /app/.venv/bin/python3 } - - { path: /app/.venv/bin/pip } + - { path: /usr/bin/python* } - { path: /usr/local/bin/uv } - { path: "/sandbox/.uv/python/**" } diff --git a/e2e/python/test_sandbox_policy.py b/e2e/python/test_sandbox_policy.py index d3e7b1250..30d1bc5f9 100644 --- a/e2e/python/test_sandbox_policy.py +++ b/e2e/python/test_sandbox_policy.py @@ -51,7 +51,7 @@ def _policy_for_python_proxy_tests() -> sandbox_pb2.SandboxPolicy: endpoints=[ sandbox_pb2.NetworkEndpoint(host="api.openai.com", port=443) ], - binaries=[sandbox_pb2.NetworkBinary(path="/app/.venv/bin/python")], + binaries=[sandbox_pb2.NetworkBinary(path="/usr/bin/python*")], ) }, ) @@ -373,7 +373,7 @@ def test_l4_binary_restricted_denies_wrong_binary( """L4-3: Policy restricted to specific binary denies others. Policy allows /usr/bin/curl -> api.anthropic.com:443. - Python (exec_python uses /app/.venv/bin/python) should be denied. + Python (exec_python uses python) should be denied. """ policy = _base_policy( network_policies={ @@ -438,7 +438,7 @@ def test_l4_cross_policy_denied( endpoints=[ sandbox_pb2.NetworkEndpoint(host="api.anthropic.com", port=443), ], - binaries=[sandbox_pb2.NetworkBinary(path="/app/.venv/bin/python")], + binaries=[sandbox_pb2.NetworkBinary(path="/usr/bin/python*")], ), "other": sandbox_pb2.NetworkPolicyRule( name="other", diff --git a/e2e/python/test_sandbox_venv.py b/e2e/python/test_sandbox_venv.py index a26087e21..8f396864e 100644 --- a/e2e/python/test_sandbox_venv.py +++ b/e2e/python/test_sandbox_venv.py @@ -37,12 +37,6 @@ def test_sandbox_venv_in_path( assert "/sandbox/.venv/bin" in path_dirs, ( f"Expected /sandbox/.venv/bin in PATH, got: {result.stdout.strip()}" ) - # /sandbox/.venv/bin must come before /app/.venv/bin - sandbox_idx = path_dirs.index("/sandbox/.venv/bin") - app_idx = path_dirs.index("/app/.venv/bin") - assert sandbox_idx < app_idx, ( - "/sandbox/.venv/bin must precede /app/.venv/bin in PATH" - ) def test_pip_install_in_sandbox( diff --git a/python/openshell/sandbox.py b/python/openshell/sandbox.py index 762f84d5c..81d0c409d 100644 --- a/python/openshell/sandbox.py +++ b/python/openshell/sandbox.py @@ -556,7 +556,7 @@ _PYTHON_CLOUDPICKLE_BOOTSTRAP = ( "print(result) if result is not None else None" ) -_SANDBOX_PYTHON_BIN = "/app/.venv/bin/python" +_SANDBOX_PYTHON_BIN = "python" def _serialize_python_callable(