Skip to content

Codex provider overrides sandbox config: networkAccess:true hard-coded; Account Pooler token reaches sandboxed commands via shell_environment_policy.set #8008

In review

Description

@obviousagentai

Versions: bb-app 0.50.1 (npm), Codex CLI 0.171.0, Linux x86_64. Admin-enforced /etc/codex/requirements.toml.

Two problems in the Codex provider. Each one overrides a sandbox restriction that the admin set in Codex's own configuration.

1. networkAccess: true is hard-coded in the workspace-write sandbox policy

server/dist/builtin-plugins/provider-codex/dist/host.js:135, toWorkspaceWriteCodexSandboxPolicy:

return {type:"workspaceWrite",writableRoots:[...e],networkAccess:!0,excludeTmpdirEnvVar:!1,excludeSlashTmp:!1}

This goes out as turn/start params.sandboxPolicy on every workspace turn (host.js:146). An explicit per-turn policy overrides Codex's config, so a requirements profile with network off has no effect:

# /etc/codex/requirements.toml
default_permissions = "sandboxed"
[allowed_permission_profiles]
sandboxed = true
[permissions.sandboxed]
extends = ":workspace"
[permissions.sandboxed.network]
enabled = false

Repro

  1. Install the requirements above.
  2. Start a Codex thread with permission mode accept-edits.
  3. Ask it to run curl -m5 -o /dev/null -w '%{http_code}' https://example.com. It prints 200, and Codex reports "Network access is enabled".

The same command with Codex's own resolution (codex sandbox -- curl …, or command/exec sent to codex app-server with networkAccess:false) fails with Could not resolve host. If the client sends networkAccess:true, it returns 200.

Expected: don't send networkAccess unless the user asked for network. Leave it to Codex's config and requirements. Alternatively, add a provider or project setting such as "sandbox network: off".

2. Provider env contributions, including the Account Pooler token, go into shell_environment_policy.set

  • server/dist/builtin-plugins/account-pool/dist/server.js:236 contributes CODEX_POOL_AUTH_TOKEN to the codex provider env, and the same value again as BB_ACCOUNT_POOL_PARENT_TOKEN (markerEntries).
  • provider-codex/dist/host.js:135, buildShellEnvironmentPolicyConfig, turns every thread env var into config["shell_environment_policy.set.<NAME>"]. That config goes out in thread/start (host.js:141, :146).
  • Codex applies set after exclude and its default *TOKEN* filter. So every sandboxed command gets the hub token in its environment, even with shell_environment_policy.exclude configured.

Repro: with the Account Pooler routing Codex, start a Codex thread and run env | grep -c TOKEN in it. The count is 2: CODEX_POOL_AUTH_TOKEN and BB_ACCOUNT_POOL_PARENT_TOKEN. Combined with issue 1, a command can send that token out.

Expected: don't put credentials in shell_environment_policy.set. The app-server already gets CODEX_POOL_AUTH_TOKEN in its own process env (host.js:144, appServerLaunchEnv), which is what env_http_headers reads for model calls. Commands don't need it. If some contributions must reach commands, let a contribution mark itself "app-server only".

Related note: login-shell PATH wins over the daemon's PATH when starting a provider

host-daemon/dist/daemon-bundle.mjs:71, searchPath, builds the provider's PATH as the login shell's PATH (from $SHELL -ilc /usr/bin/env, daemon-bundle.mjs:68) followed by the daemon's own inherited PATH. If an admin puts a wrapper directory first on the service's PATH to control which codex gets started, a user-level ~/.local/bin from the login profile still wins. Also, BB_CODEX_BRIDGE_APP_SERVER_COMMAND never reaches the provider bridge, because BB_* is stripped from its env. So there is no supported way to wrap the Codex binary. A documented provider setting for the app-server command, or putting the inherited PATH first, would help.

Activity

  1. added theissue type on Nov 22, 2026
  2. added
    providers
    security
    provider-codex
    partial-repro
    on Nov 22, 2026
  3. bb-slop-cop commented on Nov 22, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Urgent · Effort: Medium. Added providers, security, and provider-codex; no existing classifications were replaced.
    • Reproduction report: PARTIALLY REPRODUCED. Root-cause confidence: high for BB-side request construction. Reproduction label: partial-repro.
    • Root cause: workspace turns unconditionally send networkAccess: true; provider environment entries are copied into both the app-server process environment and shell_environment_policy.set, including synthetic pool-authentication entries in the test.
    • Verification: the real bridge produced both behaviors in two clean checkouts of 796cdcc0f4. The report includes the complete failing reproduction test. Existing Codex tests: 85 passed; focused pool/PATH tests and the full build also passed. Real Codex administrative-policy bypass and sandbox-command credential exposure remain unverified; no real credentials were used.
    • No PR: a repair changes sandbox permission or authentication/security boundaries, which the simple-fix rule explicitly excludes.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reproprovider-codexproviderssecurity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions