Secure, Fast, and Extensible Sandbox runtime for AI agents.
fix: move DEFAULT_ALLOW_POLICY below imports (ruff E402); smoke asserts the handler-native 412
高然c6b2c9e94732
diff --git a/components/egress/tests/smoke-fast-sandbox.sh b/components/egress/tests/smoke-fast-sandbox.shindex 2b05e3d3e..1f5352a85 100755--- a/components/egress/tests/smoke-fast-sandbox.sh+++ b/components/egress/tests/smoke-fast-sandbox.sh@@ -518,9 +518,10 @@ pass "restart durability (recorded policy supersedes the replayed binding input,# starts from the recorded policy — put back what the binding inputs intend.relay_put_policy a '{"defaultAction":"deny","egress":[{"action":"allow","target":"*.test"}]}'# DELETE tombstone across a restart, and the revision precondition: a-# stale expectedRevision is a 409 on the public contract.+# stale expectedRevision is a 412 on the handler contract (the server+# remaps it to 409 on the public API).http_code="$(curl -s -o /dev/null -w '%{http_code}' -XPUT "http://127.0.0.1:${POLICY_PORT}/policy/a" -d '{"policy":{"defaultAction":"deny","egress":[]},"expectedRevision":99}')"-[ "${http_code}" = "409" ] || fail "stale expectedRevision must be 409, got ${http_code}"+[ "${http_code}" = "412" ] || fail "stale expectedRevision must be 412, got ${http_code}"###############################################################################info "Test 10: strict DoH mode (no blocklist) drops all tcp 443 globally"diff --git a/server/opensandbox_server/services/fast_sandbox/create_mapping.py b/server/opensandbox_server/services/fast_sandbox/create_mapping.pyindex 85d342113..34c15a04c 100644--- a/server/opensandbox_server/services/fast_sandbox/create_mapping.py+++ b/server/opensandbox_server/services/fast_sandbox/create_mapping.py@@ -32,15 +32,15 @@ from typing import Optionalfrom opensandbox_server.api.schema import CreateSandboxRequestfrom opensandbox_server.services.fast_sandbox.network_policy import normalized_policy+from opensandbox_server.services.fast_sandbox.generated import (+ fastpath_pb2 as pb2,+)+# The egress binding input seeded for a sandbox created without a# networkPolicy: default-allow (behavior identical to a policy-less# sandbox) — the binding's point is subject registration, not enforcement.DEFAULT_ALLOW_POLICY = {"defaultAction": "allow", "egress": []}-from opensandbox_server.services.fast_sandbox.generated import (- fastpath_pb2 as pb2,-)-SUPPORTED_EXTENSION_KEYS = frozenset({"poolRef"})#: FastPath CreateSandboxRequest has no nullable timeout; fsb requires an explicit one.