mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #160] [CLOSED] fix(api): accept allowInternetAccess as an alias so isolation requests can't silently fail open #217
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#217
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/160
Author: @sunkencity999
Created: 8/12/2026
Status: ❌ Closed
Base:
main← Head:fix/newsandbox-allow-internet-access📝 Commits (1)
5bb536dfix(api): accept allowInternetAccess as an alias so it can't silently fail open📊 Changes
2 files changed (+48 additions, -2 deletions)
View changed files
📝
src/api/generated/src/models.rs(+10 -2)📝
src/api/impls/sandbox.rs(+38 -0)📄 Description
Follows the direction you suggested in #156:
allow_internet_accessstays canonical onNewSandboxfor E2B compatibility, andallowInternetAccessis accepted as a serde alias. Nothing is renamed and no existing client changes behaviour.You were right that the field name is intentional — I checked the E2B spec you linked and it has the same split (
NewSandboxtakes snake_case,SandboxDetailreturns camelCase), so AgentENV is mirroring the contract correctly.What this fixes
The residual problem is what happens when a caller sends the other spelling. serde drops the unknown key, so the field arrives as
None;base_policy_from_allow_internet_accessmapsNonetoBaseSandboxNetworkPolicy::Defaultrather thanDeny, and the sandbox is created with unrestricted egress after isolation was explicitly requested. Nothing rejects the request and nothing logs it.GET /sandboxes/{id}then reportsallowInternetAccess: null, which reads as "never set" rather than "your setting was discarded" — so it isn't obvious from the readback either.Callers land on the wrong spelling because the contract is internally inconsistent:
allowInternetAccessis what the response hands back and whatNewColdSandboxaccepts. The alias closes that trap without touching the canonical name.There's a second-order effect worth noting:
allowOutdomain rules only arm under aDenybase policy, so a create combiningallowInternetAccess: falsewith domain rules produced a sandbox with no egress restriction at all — neither the deny nor the allowlist.Changes
NewSandbox:#[serde(rename = "allow_internet_access", alias = "allowInternetAccess")]SandboxNetworkUpdateConfig: same alias, so both endpoints behave alikeDenybase-policy propagation from a camelCase create bodyBoth model edits are in a generated file and carry comments so a regeneration doesn't silently revert them. If you'd rather express this in
openapi.ymland regenerate — which is the more durable fix, and what you hinted at — I'm happy to close this in favour of that; the tests would still be worth keeping either way.Not addressed here
Whether an unrecognised field in a network-policy body should be rejected outright rather than ignored.
deny_unknown_fieldson these two models would turn this whole class of mistake into a 4xx instead of an open sandbox, and stays E2B-compatible since conforming clients only send known fields. It's a behaviour change, so it seemed wrong to bundle it — raised separately in #156 if you think it's worth pursuing.Closes #156 if you take this approach; happy to adjust or withdraw.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.