Add `OpenSandbox(network_policy=)` and `OpenSandboxBackend(credential_proxy=)`, passing OpenSandbox's egress options through
Closes #13593
Stack: #13587 E2B network → #13589 boxd secrets → #13590 Daytona secrets → #13591 OpenSandbox network_policy/credential_proxy → #13592 clai2 /sandbox. Each harness PR stands alone; clai2 uses the first two.
Why we make these changes
Part of #13593. An agent in a cloud sandbox needs credentials (a GitHub token for git push and gh) that its commands can use but not read, so a prompt injection cannot copy them out. OpenSandbox's Credential Vault keeps credentials in the server's egress sidecar and adds them to requests for bound hosts. This PR passes that option through unchanged, under the SDK's own name, so users write what the provider documents.
New public surface
OpenSandbox(network_policy=)andOpenSandboxBackend(network_policy=, credential_proxy=): the SDK'sNetworkPolicyandCredentialProxyConfig, passed toSandbox.create.credential_proxyis on the backend only. The vault must be filled after the sandbox exists and before the agent's first command, which only a backend you create yourself allows; on the capability it would make a sandbox with an empty vault.
User-visible behavior
Before: no way to give the sandbox's commands a credential they cannot read. After: the new docs section "Give commands a credential they cannot read" shows it for a GitHub token. Without the option, sandbox creation is unchanged.
Verification
tests/harness/opensandbox_sandbox/test_backend.py::test_network_policy_and_credential_proxy_pass_through,tests/harness/opensandbox_sandbox/test_opensandbox_sandbox.py::test_network_policy_reaches_creation- The sidecar replacing a header the sandbox sent is from its source:
components/egress/mitmscripts/system.pydeletes the header, then sets the credential. - Live, with a dummy token, on a local
opensandbox-server1.2.1 indns+nftmode with the SDK'sCredentialProxyConfigand a deny-by-defaultNetworkPolicy:- an HTTPS request carrying
Authorization: token placeholderreached the echo host asBearer <dummy>; - plain HTTP kept the placeholder, and a host not on the allow list was blocked;
- the sandbox trusted the server's certificate with no setup, and
mode = "dns"refusedcredential_proxy; - the echo host's response showed the real value, so the docs say to list only hosts that never send headers back.
- an HTTPS request carrying
- Not run live: the same through
OpenSandboxBackend(the pass-through is covered by the tests above).
What changes for existing users
Nothing.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.