AP002: Secret in agent settings
| Severity | critical |
| Runs in | scan, pack, guard hook, git push check |
| One-line fix | Rotate this key, remove it from the settings file, and load it from an environment variable instead. |
What it finds
Section titled “What it finds”A key written in an agent’s settings, permission allowlist or config file, such as
~/.claude/settings.json or .claude/settings.local.json. It also finds a key inside an agent
file that would ship in a package (see AP006) or sits in a tracked
settings file that a git push would send.
Each print shows the line and the key masked, for example sk-p…(len 56).
Why it matters
Section titled “Why it matters”A key in a settings file is a key in plain text. Project settings files are often committed, and package files are public the moment you publish. A published key has to be treated as stolen.
How to fix
Section titled “How to fix”- Rotate the key. Revoke it and create a new one with its provider.
- Delete the key from the file and load it from an environment variable instead.
- If the file is in a package or in git, remove it there too (see AP006 and AP007).
Limits
Section titled “Limits”- Pattern-based only. An odd key format can be missed.
- A key inside an MCP server entry is reported as AP005 instead, with a fix that fits MCP.
- agentprint never uses the key, so it cannot say whether it still works.