Proposal: harden secret file reads and exec output redaction
Summary
Following the contribution guidance that external code contributions should start with an issue, I wanted to share a small security-hardening proposal and a working branch from my fork.
Fork PR with the proposed patch: https://github.com/Dearli666/codex/pull/1
The patch does two things:
- Adds default deny-read filesystem entries for common secret-bearing files and folders in workspace roots and selected home-scoped paths.
- Redacts common secret patterns from exec output before tool results are sent back to the model.
I also added an explicit follow-up commit to cover root-level workspace secret files such as .env, .npmrc, and *.pem, instead of relying only on recursive glob behavior.
Motivation
Codex frequently runs shell commands in repositories. Even when command execution is legitimate, common local files such as .env, cloud credential files, SSH keys, package registry tokens, and private key material should have defense-in-depth protection against accidental reads or accidental echoing back into model-visible output.
Current branch status
- Branch: https://github.com/Dearli666/codex/tree/harden-secret-read-and-output-redaction
- Fork PR: https://github.com/Dearli666/codex/pull/1
- Synced with upstream main before publishing the fork PR.
- Local verification: git diff --check passed.
- I could not run Rust tests locally because this machine does not currently have cargo/rustc installed.
Request
If this direction aligns with the Codex team's intended approach, could a maintainer advise whether this should be discussed further here or whether an invited upstream PR would be appropriate? Happy to adjust the approach based on guidance.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗