Skip to content

Enforce workspace metadata protections in Seatbelt#19847

Merged
evawong-oai merged 1 commit intomainfrom
codex/bugb15632-seatbelt-preserved-paths
Apr 28, 2026
Merged

Enforce workspace metadata protections in Seatbelt#19847
evawong-oai merged 1 commit intomainfrom
codex/bugb15632-seatbelt-preserved-paths

Conversation

@evawong-oai
Copy link
Copy Markdown
Contributor

@evawong-oai evawong-oai commented Apr 27, 2026

Summary

Translate FileSystemSandboxPolicy project root metadata carveouts into macOS Seatbelt rules.

Scope

  1. Thread protected metadata names into Seatbelt access roots.
  2. Ask FileSystemSandboxPolicy whether each metadata carveout is writable.
  3. Emit Seatbelt deny rules that block creating or replacing protected metadata names under writable roots.
  4. Add coverage for first time metadata creation and read only carveouts.

Reviewer Focus

  1. This PR only covers the macOS sandbox adapter.
  2. The policy decision comes from FileSystemSandboxPolicy.
  3. Read only subpath carveouts and metadata protection checks should compose cleanly.

Stack

  1. Policy primitive: [sandbox] Enforce protected workspace metadata paths #19846
  2. macOS Seatbelt adapter: this PR
  3. Shell preflight UX: Add workspace metadata shell preflight #19848
  4. Runtime profile propagation: Propagate runtime permission profiles #19849
  5. Linux bubblewrap adapter: Enforce workspace metadata protections in Linux sandbox #19852

Validation

  1. formatting for codex sandboxing
  2. codex sandboxing package tests

@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 82c9632 to 1bbee67 Compare April 27, 2026 18:31
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch 2 times, most recently from fe774aa to 017761a Compare April 27, 2026 18:40
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 1bbee67 to 3353479 Compare April 27, 2026 18:40
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from 017761a to 613fe13 Compare April 27, 2026 18:55
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 0cfa95f to a99da8c Compare April 27, 2026 19:07
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from 613fe13 to 6e4de4c Compare April 27, 2026 19:07
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from a99da8c to 5b59ee3 Compare April 27, 2026 19:48
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch 2 times, most recently from 0b8c428 to 6541b90 Compare April 27, 2026 20:52
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch 2 times, most recently from 01771db to 11fa852 Compare April 27, 2026 21:14
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from 6541b90 to c2bf30f Compare April 27, 2026 21:14
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 11fa852 to ab4b378 Compare April 27, 2026 22:21
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from c2bf30f to 5e3f0d4 Compare April 27, 2026 22:21
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from ab4b378 to 8e60a50 Compare April 28, 2026 00:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch 2 times, most recently from ea88850 to c008a8f Compare April 28, 2026 01:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 8e60a50 to 0b263d0 Compare April 28, 2026 01:10
@evawong-oai evawong-oai changed the title Enforce preserved path names in Seatbelt Enforce workspace metadata protections in Seatbelt Apr 28, 2026
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from c008a8f to a767cac Compare April 28, 2026 03:15
@evawong-oai evawong-oai force-pushed the codex/bugb15632-policy-primitive branch from 0b263d0 to 3ed97f5 Compare April 28, 2026 03:15
evawong-oai added a commit that referenced this pull request Apr 28, 2026
## Summary

Make FileSystemSandboxPolicy the semantic source of truth for project
root metadata protection. Under writable roots, `.git`, `.codex`, and
`.agents` stay protected unless user policy grants an explicit write
rule for that metadata path.

## Scope

1. Add `protected_metadata_names` to `WritableRoot`.
2. Teach `FileSystemSandboxPolicy::can_write_path_with_cwd` to reject
protected metadata writes under writable roots unless explicitly
allowed.
3. Default workspace write profiles to protect `.git`, `.codex`, and
`.agents`.
4. Add the Linux fallback setup needed before Linux enforcement lands
later in the stack.

## Reviewer Focus

1. The policy decision belongs in FileSystemSandboxPolicy, not shell
command parsing.
2. Legacy SandboxPolicy remains a compatibility projection, not the
source of the new rule.
3. Explicit user write rules can still opt into these metadata paths.

## Stack

1. Policy primitive: this PR
2. macOS Seatbelt adapter: #19847
3. Shell preflight UX: #19848
4. Runtime profile propagation: #19849
5. Linux bubblewrap adapter: #19852

## Validation

1. codex protocol permissions tests
2. formatting for codex protocol and codex linux sandbox
3. diff whitespace check
Base automatically changed from codex/bugb15632-policy-primitive to main April 28, 2026 16:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632-seatbelt-preserved-paths branch from a767cac to 19909d3 Compare April 28, 2026 16:19
@viyatb-oai viyatb-oai marked this pull request as ready for review April 28, 2026 16:19
@evawong-oai evawong-oai requested review from bolinfest and viyatb-oai and removed request for bolinfest April 28, 2026 16:32
@evawong-oai evawong-oai merged commit 0670d89 into main Apr 28, 2026
25 checks passed
@evawong-oai evawong-oai deleted the codex/bugb15632-seatbelt-preserved-paths branch April 28, 2026 17:13
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 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