Skip to content

macOS: network_access = true in config.toml silently ignored by seatbelt sandbox — workaround included #10390

Description

@fede-kamel

Problem

On macOS, setting network_access = true under [sandbox_workspace_write] in ~/.codex/config.toml has no effect. The seatbelt sandbox unconditionally sets CODEX_SANDBOX_NETWORK_DISABLED=1, causing all outbound network calls (OCI CLI, curl, API clients, etc.) to fail with connection timeouts.

This affects any workflow that requires network access from within a Codex session — cloud CLI tools (OCI, AWS, GCP), package registries, API calls, etc.

Environment:

  • macOS (Darwin 25.2.0)
  • Codex CLI installed via Homebrew (/opt/homebrew/bin/codex)
  • config.toml with network_access = true under [sandbox_workspace_write]

Reproduction:

  1. Set network_access = true in ~/.codex/config.toml:
    [sandbox_workspace_write]
    network_access = true
  2. Launch codex and run any network command (e.g. curl https://example.com or an OCI/AWS CLI call)
  3. Command fails with connection timeout / "not reachable"

Root cause: The macOS seatbelt sandbox profile (codex-rs/core/src/seatbelt_network_policy.sbpl) enforces network blocking at the OS level regardless of config.toml.

Confirmed Workaround

The only reliable fix is bypassing the seatbelt sandbox via CLI flag:

codex --sandbox danger-full-access "your prompt"

Or as a persistent shell alias:

alias codex='CODEX_SANDBOX_NETWORK_DISABLED=0 codex --sandbox danger-full-access'

Setting sandbox_mode = "danger-full-access" in config.toml alone is not sufficient — the CLI flag is required.

Proposed Fix

The seatbelt profile should respect the network_access = true configuration from config.toml the same way the Linux Landlock sandbox does. When a user explicitly opts in to network access via config, the seatbelt policy should conditionally allow outbound connections instead of unconditionally blocking them.

A potential implementation path:

  1. In codex-rs/core, read network_access from the resolved config before generating the seatbelt profile
  2. Conditionally include/exclude the network deny rule in seatbelt_network_policy.sbpl
  3. This would make macOS behavior consistent with the documented config.toml settings

Happy to submit a PR if the team agrees with this approach.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions