Skip to content

config: add initial support for the new permission profile config language in config.toml#13434

Merged
bolinfest merged 1 commit intomainfrom
pr13434
Mar 6, 2026
Merged

config: add initial support for the new permission profile config language in config.toml#13434
bolinfest merged 1 commit intomainfrom
pr13434

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Mar 4, 2026

Why

SandboxPolicy currently mixes together three separate concerns:

  • parsing layered config from config.toml
  • representing filesystem sandbox state
  • carrying basic network policy alongside filesystem choices

That makes the existing config awkward to extend and blocks the new TOML proposal where [permissions] becomes a table of named permission profiles selected by default_permissions. (The idea is that if default_permissions is not specified, we assume the user is opting into the "traditional" way to configure the sandbox.)

This PR adds the config-side plumbing for those profiles while still projecting back to the legacy SandboxPolicy shape that the current macOS and Linux sandbox backends consume.

It also tightens the filesystem profile model so scoped entries only exist for :project_roots, and so nested keys must stay within a project root instead of using . or .. traversal.

This drops support for the short-lived [permissions.network] in config.toml because now that would be interpreted as a profile named network within [permissions].

What Changed

  • added PermissionsToml, PermissionProfileToml, FilesystemPermissionsToml, and FilesystemPermissionToml so config can parse named profiles under [permissions.<profile>.filesystem]
  • added top-level default_permissions selection, validation for missing or unknown profiles, and compilation from a named profile into split FileSystemSandboxPolicy and NetworkSandboxPolicy values
  • taught config loading to choose between the legacy sandbox_mode path and the profile-based path without breaking legacy users
  • introduced codex-protocol::permissions for the split filesystem and network sandbox types, and stored those alongside the legacy projected sandbox_policy in runtime Permissions
  • modeled FileSystemSpecialPath so only ProjectRoots can carry a nested subpath, matching the intended config syntax instead of allowing invalid states for other special paths
  • restricted scoped filesystem maps to :project_roots, with validation that nested entries are non-empty descendant paths and cannot use . or .. to escape the project root
  • kept existing runtime consumers working by projecting FileSystemSandboxPolicy back into SandboxPolicy, with an explicit error for profiles that request writes outside the workspace root
  • loaded proxy settings from top-level [network]
  • regenerated core/config.schema.json

Verification

  • added config coverage for profile deserialization, default_permissions selection, top-level [network] loading, network enablement, rejection of writes outside the workspace root, rejection of nested entries for non-:project_roots special paths, and rejection of parent-directory traversal in :project_roots maps
  • added protocol coverage for the legacy bridge rejecting non-workspace writes

Docs

  • update the Codex config docs on developers.openai.com/codex to document named [permissions.<profile>] entries, default_permissions, scoped :project_roots syntax, the descendant-path restriction for nested :project_roots entries, and top-level [network] proxy configuration

Stack created with Sapling. Best reviewed with ReviewStack.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57adb8739f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

bolinfest added a commit that referenced this pull request Mar 4, 2026
@bolinfest bolinfest force-pushed the pr13434 branch 2 times, most recently from 15b518e to 7abd701 Compare March 4, 2026 09:10
@bolinfest bolinfest force-pushed the pr13434 branch 11 times, most recently from c19cf38 to fac9b40 Compare March 6, 2026 22:12
@bolinfest bolinfest requested a review from viyatb-oai March 6, 2026 22:29
@bolinfest bolinfest changed the title config: add v3 filesystem permission profiles config: introduce new permission profiles syntax in config.toml Mar 6, 2026
@bolinfest bolinfest changed the title config: introduce new permission profiles syntax in config.toml config: initial work for new permission profiles syntax in config.toml Mar 6, 2026
fn config_toml_deserializes_permissions_network() {
let toml = r#"
[permissions.network]
[network]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this expecting a top level [network] entry? shouldn't it be permissions.<profile>.network? we don't need backwards compatibility here..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it seems like Codex was trying to be "helpful" on the backwards compatibility front. I'll remove...

@bolinfest bolinfest changed the title config: initial work for new permission profiles syntax in config.toml config: add v3 filesystem permission profiles Mar 6, 2026
@bolinfest bolinfest changed the title config: add v3 filesystem permission profiles config: add initial support for the new permission profile config language in config.toml Mar 6, 2026
@bolinfest bolinfest merged commit f82678b into main Mar 6, 2026
73 of 83 checks passed
@bolinfest bolinfest deleted the pr13434 branch March 6, 2026 23:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants