Expand MacOS Seatbelt-exec sandbox with network_access = true to restrict to localhost

Resolved 💬 2 comments Opened Nov 18, 2025 by stellar-scottreed Closed Nov 18, 2025

What feature would you like to see?

On MacOS when the sandbox is used, and [sandbox_workspace_write] network_access = true, it appears the network policy is loaded in at codex-rs/core/src/seatbelt_network_policy.sbpl

Currently there is no way to customize the network policy. My request is to add a new parameter to the [sandbox_workspace_write] configuration called something like "local_network_access" = true, and if that is enabled then it uses a different policy which only allows localhost network access within the sandbox.

The specific use-case is that I would like to allow network access to local resources and ports on my machine (ie a local database when running scripts), but I want to prohibit remote network access for security.

It appears based on my limited research that this is possible, that sandbox-exec allows you to allow access to * or to localhost. Source: https://lucaswiman.github.io/2023/06/04/macos-sandbox.html

Additional information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗