How do AI coding agents end up seeing secrets?
Through anything they can read: files beside the code, terminal output and the details of running processes.
The obvious path is a plain-text file of secrets in the repository. The less obvious path is output. A command that lists running processes can print the values that were injected into them.
That is what happened to me. The secrets were in a proper secret store, injected only at runtime, and a process-inspection command still printed them into the agent's output.
The controls have to cover the whole path: keep values outside the repository, inject them only at runtime, write variable names and never values in documentation, scan changes for secrets, and treat process output as a place a secret can appear.
Lessons that use it
- 16Keep secrets out of sightAn agent can read files, terminal output and process details. A secret can be in all three.
The ruleAssume anything an agent can print, it can read.