Skip to content

Enforce workspace metadata protections in Linux sandbox#19852

Merged
evawong-oai merged 3 commits intomainfrom
codex/bugb15632_missing_protected_paths_v2
Apr 29, 2026
Merged

Enforce workspace metadata protections in Linux sandbox#19852
evawong-oai merged 3 commits intomainfrom
codex/bugb15632_missing_protected_paths_v2

Conversation

@evawong-oai
Copy link
Copy Markdown
Contributor

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

Summary

Enforce FileSystemSandboxPolicy protected metadata names in the Linux bubblewrap adapter so .git, .agents, and .codex remain read only inside writable workspace roots unless the policy grants an explicit write carveout.

Scope

  1. Translate protected metadata names from FileSystemSandboxPolicy into bubblewrap masks for existing metadata paths.
  2. Represent missing protected metadata paths as guarded mount targets so agents cannot create .git, .agents, or .codex under writable roots.
  3. Preserve normal git discovery for existing repos, worktrees, and parent repos.
  4. Keep explicit user write grants working when policy allows a protected metadata path directly.

Not in scope

  1. No shell preflight UX.
  2. No TUI runtime profile propagation.
  3. No macOS Seatbelt changes in this PR.

Reviewer focus

  1. This should be reviewed as the Linux enforcement adapter for the policy primitive from PR 19846.
  2. macOS enforcement already landed in PR 19847.
  3. The important invariant is that FileSystemSandboxPolicy is the source of truth for .git, .agents, and .codex.

Validation

  1. git diff whitespace check passed.
  2. cargo fmt check passed with the existing stable rustfmt warning about imports_granularity.
  3. Full Linux sandbox Cargo test suite passed on the devbox.
  4. Devbox forty six case suite passed at head 012accb703c13bd28df5b40079a9bf183036336a.
  5. Devbox summary: pass 46, fail 0.
  6. The devbox suite was run through just c sandbox linux.
  7. Focused repo test for Viyat parent repo case passed on the devbox.

@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from f23239c to 2e4f779 Compare April 27, 2026 18:32
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch 2 times, most recently from 56fd774 to 7b2a10c Compare April 27, 2026 18:40
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from 2e4f779 to 774934a Compare April 27, 2026 18:40
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 7b2a10c to 7917f64 Compare April 27, 2026 18:55
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from 774934a to 21cfe9c Compare April 27, 2026 18:55
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 7917f64 to fa82006 Compare April 27, 2026 19:07
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from 4e95f07 to 5f6cf03 Compare April 27, 2026 19:49
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch 2 times, most recently from 87b8a74 to 83c8532 Compare April 27, 2026 20:52
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch 2 times, most recently from a73dc93 to f483023 Compare April 27, 2026 21:14
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch 3 times, most recently from f22eea7 to 315a0c1 Compare April 27, 2026 21:32
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from f483023 to 9d4f283 Compare April 27, 2026 22:22
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 315a0c1 to 684fe6f Compare April 27, 2026 22:22
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from 9d4f283 to 4db4407 Compare April 28, 2026 00:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch 2 times, most recently from 4c3c7d4 to b544225 Compare April 28, 2026 00:17
@evawong-oai evawong-oai force-pushed the codex/bugb15632-runtime-permissions branch from 4db4407 to e8365c7 Compare April 28, 2026 01:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from b544225 to 9125e97 Compare April 28, 2026 01:10
@evawong-oai evawong-oai changed the title Enforce preserved path names in Linux sandbox Enforce workspace metadata protections in Linux sandbox Apr 28, 2026
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 9125e97 to 8cf7592 Compare April 28, 2026 03:15
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 372c9e0 to 619bea4 Compare April 28, 2026 23:10
@evawong-oai evawong-oai changed the base branch from codex/bugb15632-runtime-permissions to main April 28, 2026 23:10
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch 16 times, most recently from 7c52dc9 to 3a3b71b Compare April 29, 2026 03:03
@evawong-oai evawong-oai force-pushed the codex/bugb15632_missing_protected_paths_v2 branch from 3a3b71b to ca4b5c6 Compare April 29, 2026 03:08
@evawong-oai evawong-oai marked this pull request as ready for review April 29, 2026 04:22
Copy link
Copy Markdown
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: ca4b5c6387

ℹ️ 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".

Comment thread codex-rs/linux-sandbox/src/linux_run_main.rs
Comment thread codex-rs/linux-sandbox/src/linux_run_main.rs Outdated
Comment thread codex-rs/linux-sandbox/src/bwrap.rs Outdated
Comment thread codex-rs/linux-sandbox/src/bwrap.rs Outdated
@evawong-oai
Copy link
Copy Markdown
Contributor Author

Thanks. I am keeping this PR scoped to the Linux sandbox protection fix. A follow up cleanup PR will modularize the bwrap code so this logic is easier to review and maintain.

@evawong-oai evawong-oai merged commit 74f06dc into main Apr 29, 2026
25 checks passed
@evawong-oai evawong-oai deleted the codex/bugb15632_missing_protected_paths_v2 branch April 29, 2026 23:14
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 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