Linux sandbox: bwrap "Bad file descriptor" when a workspace root contains two or more denied files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Codex aborts at startup when a workspace root contains two or more files matched by deny filesystem rules. One denied file works; two or more always fail.
bwrap: Can't write data to file <workspace>/one.key: Bad file descriptor
Repro
Isolated CODEX_HOME, dummy files only, no real secrets.
default_permissions = "test"
[permissions.test.network]
enabled = false
[permissions.test.filesystem]
":minimal" = "read"
"<path to installed @openai package dir>" = "read"
[permissions.test.filesystem.":workspace_roots"]
"." = "write"
"**/*.key" = "deny"
"**/.env.local" = "deny"
codex sandbox -P test -C <workspace> -- /bin/true
| denied files present | result |
|---|---|
| 0 | exit 0 |
| 1 | exit 0 |
| 2+ | exit 1, Bad file descriptor |
Also observed
- Same on 0.153.4 and 0.152.1, so not a recent regression. Linux x86_64, bundled
bwrap. - Independent of exact paths vs globs, subdirectories, read-only vs writable workspace root, and
glob_scan_max_depth. - Denying a directory containing the same files works and correctly blocks reads.
-c use_legacy_landlock=trueis not a workaround:permission profiles requiring direct runtime enforcement are incompatible with --use-legacy-landlock.
Impact
Any real project with two or more .env/key files cannot start Codex without removing the very rules that keep those files unreadable. The same failure occurs during normal TUI startup while loading AGENTS.md.
Related but distinct: #40433 (malformed or missing path rules).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the codex sandbox entry point and reproduce the Linux failure with the provided TOML rules and /bin/true command. Trace the bundled bwrap setup for multiple denied files, then verify that two or more denied files allow startup while remaining unreadable, including during normal TUI startup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100