Codex should never read or print environment variables
Resolved 💬 3 comments Opened Mar 3, 2026 by karthikp32 Closed Mar 3, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
No description provided.
3 Comments
Can you provide more details?
I'm guessing that you're referring to sandboxed environments that Codex creates when running tools.
Please refer to this documentation for details about the shell environment policy configuration knobs provided by Codex.
Yes, Codex read my .env file and env variables with SECRET in the name. I don't want to those secrets or API keys to be spit out by ChatGPT or Codex to another user
An
.envfile is different from environment variables. If you have an.envfile in your project directory, then it's readable. That's by design, so not something we'd consider a bug.There is a feature request for excluding sensitive files. If you'd like to see that, please upvote that issue.