Skip to content

feat(api): add allow_internet_access to /sandboxes/{id}/network#2433

Open
levb wants to merge 2 commits intomainfrom
lev-egress-OFF
Open

feat(api): add allow_internet_access to /sandboxes/{id}/network#2433
levb wants to merge 2 commits intomainfrom
lev-egress-OFF

Conversation

@levb
Copy link
Copy Markdown
Contributor

@levb levb commented Apr 17, 2026

Adds the same allow_internet_access bool from the create sandbox API to the update network endpoint. When false, blocks all internet access (deny 0.0.0.0/0) via buildNetworkConfig — the same code path used at sandbox creation. When true or omitted, no effect.

Adds the same allow_internet_access bool from the create sandbox API to
the update network endpoint. When false, blocks all internet access
(deny 0.0.0.0/0) via buildNetworkConfig — the same code path used at
sandbox creation. When true or omitted, no effect.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

sbx.Network.Egress = &types.SandboxNetworkEgressConfig{
AllowedAddresses: allowedEntries,
DeniedAddresses: deniedEntries,
}

P1 Badge Persist allow_internet_access on network updates

This path applies allowInternetAccess only to the egress sent to the node (buildNetworkConfig) but never writes it back to the sandbox model in updateFunc. That leaves runtime state inconsistent: GET /sandboxes/{id} keeps returning the old allowInternetAccess, and pause/resume can lose the block-all behavior because snapshot persistence reads sbx.AllowInternetAccess and sbx.Network (buildUpsertSnapshotParams in pause_instance.go). A request like { "allow_internet_access": false } therefore blocks traffic immediately but is not durable across state transitions.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/api/internal/orchestrator/update_network.go
Comment thread packages/api/internal/api/api.gen.go
…resume

The update network handler applied the deny-all rule to the live node
but didn't write AllowInternetAccess back to the sandbox store, so
pause/resume would lose the setting. Also adds an integration test
that verifies allow_internet_access=false survives a pause/resume cycle.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants