Skip to content

feat(network): add allowAllDomains flag to bypass allowlist - #283

Open
smolyn wants to merge 8 commits into
anthropics:mainfrom
ubc:gs/allow-all-domains
Open

smolyn wants to merge 8 commits into
anthropics:mainfrom
ubc:gs/allow-all-domains

Conversation

@smolyn

@smolyn smolyn commented May 27, 2026

Copy link
Copy Markdown

Summary

Adds an optional network.allowAllDomains: boolean field to the config schema. When set, filterNetworkRequest short-circuits to allow after the existing deniedDomains check runs, so explicit denies still take effect.

Motivation

Today the config schema requires allowedDomains and rejects "*" / "*.com"-style wildcards (sandbox-config.ts:43-44). For setups that rely on filesystem restrictions as the primary boundary, this means enumerating every domain that might be reached during normal work — for example, looking up docs for a random library — which becomes whack-a-mole. There's already an internal "no network restriction" branch in sandbox-manager.ts:670, but it's unreachable from the CLI because the schema mandates allowedDomains as an array, and any settings file gives hasNetworkConfig === true.

This flag provides an explicit, schema-validated way to opt into allow-all egress while keeping deniedDomains as an enforced denylist.

Behavior

  • allowAllDomains: undefined or false (default): unchanged
  • allowAllDomains: true: every host passes filterNetworkRequest after the deniedDomains check, so an explicit deny still wins
{
  "network": {
    "allowedDomains": [],
    "deniedDomains": ["gist.github.com"],
    "allowAllDomains": true
  }
}

Changes

  • src/sandbox/sandbox-config.ts — add the optional field to NetworkConfigSchema with a description that calls out the deny precedence
  • src/sandbox/sandbox-manager.ts — add an early-return in filterNetworkRequest after the deny loop
  • test/config-validation.test.ts — schema test verifying allowAllDomains: true validates alongside deniedDomains

+35 lines total, all additive — existing configs are unaffected.

Test plan

  • pnpm exec tsc --noEmit clean
  • test/config-validation.test.ts (schema-level): new test passes
  • End-to-end verification on macOS with srt --settings:
    • https://www.npmjs.com/ → reaches origin (403 from npm, not a sandbox block) ✓
    • https://stackoverflow.com/ → 302 ✓
    • https://docs.rs/ → 200 ✓
    • https://gist.github.com/ (in deniedDomains) → blocked at proxy ✓
    • Filesystem reads under denyRead still blocked ✓
  • Linux integration verification (not run locally — proxy filter is platform-agnostic; would appreciate CI confirmation)

🤖 Generated with Claude Code

smolyn added a commit to ubc/ltic-ai-guidelines that referenced this pull request May 27, 2026
Two srt settings files (strict + permissive postures), zsh/bash shell
functions for launching Claude inside the sandbox, and a README
covering rationale and setup.

The configs rely on a new allowAllDomains flag added in a fork of
sandbox-runtime (upstream PR: anthropics/sandbox-runtime#283).
README documents how to install from ubc/sandbox-runtime#gs/allow-all-domains
until that PR lands. Threat model treats filesystem restrictions as the
primary boundary; web egress is broadly allowed with explicit denies
for the riskiest paths.
@smolyn
smolyn force-pushed the gs/allow-all-domains branch from e372c47 to 223de24 Compare June 30, 2026 18:41
When `network.allowAllDomains: true`, filterNetworkRequest short-circuits
to allow after the deniedDomains check runs, so explicit denies still take
effect. Intended for environments where filesystem restrictions are the
primary boundary and enumerating every reachable domain is impractical
(e.g. opening web docs lookups in an otherwise locked-down sandbox).

The flag is optional and additive: existing configs are unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@smolyn
smolyn force-pushed the gs/allow-all-domains branch from 223de24 to d20d944 Compare June 30, 2026 19:27
smolyn and others added 4 commits July 13, 2026 13:17
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ains

The injectHosts ⊆ allowedDomains reachability check predates
allowAllDomains: with the flag on, every host is reachable, but the
validator still demanded allowlist entries the flag makes meaningless —
the documented masking recipe (empty allowlist + injectHosts toward
GitHub) failed to load without padding allowedDomains.

Skip the subset check when allowAllDomains is set. Conversely, add the
missing guard for the trap that combination creates: a masked credential
with no injectHosts defaults to allowedDomains, which under
allowAllDomains is typically empty — masked but injected nowhere, a
silent auth failure. That spelling is now a validation error asking for
explicit injectHosts. The excludeDomains contradiction checks and the
explicit-empty-injectHosts rejection are unchanged.
smolyn and others added 3 commits September 24, 2026 16:31
…k names

Upstream's resolved-address guard treats an allow-listed IP literal or
localhost name as an explicit choice and skips its checks. The flag's
short-circuit made every such destination count as allow-listed, so
169.254.169.254, 127.0.0.1 and localhost were reachable. The flag now
covers hostnames only; those destinations still need an allowedDomains
entry.

This branch has not been deployed

No deployments
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