Skip to content

fix(permissions): fix symlinked writable roots in sandbox permissions#15981

Merged
viyatb-oai merged 18 commits intomainfrom
codex/viyatb/investigate-issue-15781
Apr 11, 2026
Merged

fix(permissions): fix symlinked writable roots in sandbox permissions#15981
viyatb-oai merged 18 commits intomainfrom
codex/viyatb/investigate-issue-15781

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Mar 27, 2026

Summary

  • preserve logical symlink paths during permission normalization and config cwd handling
  • bind real targets for symlinked readable/writable roots in bwrap and remap carveouts and unreadable roots there
  • add regressions for symlinked carveouts and nested symlink escape masking

Root cause

Permission normalization canonicalized symlinked writable roots and cwd to their real targets too early. That drifted policy checks away from the logical paths the sandboxed process can actually address, while bwrap still needed the real targets for mounts. The mismatch caused shell and apply_patch failures on symlinked writable roots.

Impact

Fixes #15781.

Also fixes #17079:

Related to #15157:

  • Symlinks are not resolved for permission checks #15157 is the broader permission-check side of this path-identity problem. This PR addresses the shared logical-vs-canonical normalization issue, but the reported Darwin prompt behavior should be validated separately before auto-closing it.

This should also fix #14672, #14694, #14715, and #15725:

Notes

  • Added Linux-only regressions for symlinked writable ancestors and protected symlinked directory targets, including nested symlink escape masking without rebinding the escape target writable.

@viyatb-oai viyatb-oai changed the title [codex] Fix symlinked writable roots in sandbox permissions fix(permissions): fix symlinked writable roots in sandbox permissions Mar 27, 2026
Co-authored-by: Codex <noreply@openai.com>
@viyatb-oai viyatb-oai marked this pull request as ready for review March 30, 2026 17:58
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: 532001fabb

ℹ️ 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/bwrap.rs
Co-authored-by: Codex noreply@openai.com
@viyatb-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

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: 5072f6d2fa

ℹ️ 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/utils/absolute-path/src/lib.rs
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Whew, keeping track of when paths are already canonicalized and when they are not is difficult. We should think about whether there's a way to make this clearer through variable names or even types, but that's beyond the scope of this PR. I'm going to have to place some trust in codex's reviews because I can't say with confidence that there's no bug here. I did spend quite a bit of time reviewing, and I didn't find any issues. This will be a nice fix to get in place!

@viyatb-oai viyatb-oai merged commit b114781 into main Apr 11, 2026
29 of 30 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/investigate-issue-15781 branch April 11, 2026 00:01
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants