Support project-scoped loopback listener allowlists without enabling allow_local_binding

Open
#35,768 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
macos, rust

Research direction

Start with codex-rs/sandboxing/src/seatbelt.rs, especially the linked lines 283-309, and review related issues #23973, #33227, and #24742. Map how permission profiles are represented and enforced in CLI and Desktop before defining the cross-platform design. Done means project-scoped loopback address and port allowlists work without enabling broader local binding or outbound access.

Written by the indexing model from the issue text.

Description

app CLI config enhancement sandbox
What variant of Codex are you using?

Codex Desktop and CLI on macOS.

What feature would you like to see?

Add a first-class permission for narrowly allowing loopback listeners by address and port within a named permission profile.

For example, an illustrative configuration might be:

[permissions.workspace-tests.network]
enabled = true
allow_local_binding = false

[[permissions.workspace-tests.network.listeners]]
addresses = ["127.0.0.1", "::1"]
ports = "ephemeral"

This would let tests create local HTTP servers using an OS-assigned port without broadly enabling local binding or access to other local/private-network services.

The setting should:

  • Be usable from a trusted project's .codex/config.toml.
  • Apply only when that project's permission profile is selected.
  • Permit bind() only on the declared loopback addresses and ports.
  • Not allow non-loopback listeners.
  • Not grant additional outbound access to local or private-network targets.
  • Be supported consistently by CLI and Desktop execution.
  • Keep the global allow_local_binding = false default intact.
Motivation

Some unit tests create an in-process loopback server:

import socket

server = socket.socket()
server.bind(("127.0.0.1", 0))
print(server.getsockname())

With allow_local_binding = false, this fails with:

PermissionError: [Errno 1] Operation not permitted

Setting allow_local_binding = true permits the tests, but is broader than necessary. The current macOS policy permits wildcard local binds when enabled and also uses the setting for a DNS carve-out (current Seatbelt implementation, PR #17370).

A typed listener allowlist would provide a portable, auditable least-privilege alternative.

Related issues
  • #23973 concerns Desktop ignoring allow_local_binding = true.
  • #33227 concerns outbound connections to explicitly allowlisted loopback targets.
  • #24742 proposes raw user-provided macOS Seatbelt rules. That could offer a platform-specific escape hatch, but not a validated, cross-platform listener permission.
Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.