Skip to content

AAK-SECRET-011: Claude Code's settings.local.json is not ignored by git

Severity
MEDIUM
Category
Secret Exposure (secret-exposure)
Scanner
agent_audit_kit/scanners/secret_exposure.py
Auto-fixable
No.
SARIF name
AgentLocalSettingsNotIgnored

What it detects

.claude/settings.local.json exists at the project root and neither the root .gitignore nor .claude/.gitignore ignores it. Claude Code writes a user's "Yes, and don't ask again" answers into this file as allow rules, each the exact command, credentials included (AAK-SECRET-010), so a commit publishes them: Apiiro found 104,185 public copies of the file (The Hacker News, 7 Nov 2026).

How to fix

Add .claude/settings.local.json to .gitignore, remove the file from the index (git rm --cached .claude/settings.local.json), and rotate any credential it ever held: it stays in every commit that included it.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-SECRET-011

Limitations

Looks at .claude/settings.local.json in the project root only, and reads only the root .gitignore and .claude/.gitignore, as git applies them: a pattern with no / matches the name at any depth, any other / anchors it, a trailing / matches folders only, and a file inside an ignored folder stays ignored whatever a later ! line says. A global excludes file (core.excludesFile), .git/info/exclude and the index are not read, so a file ignored only there, or never committed, is still reported; a file already committed is reported only while the .gitignore misses it, though ignoring it does not remove it from git. Another agent's local settings file is not looked for. Each .gitignore is read up to the last line that ends within its first 1,000,000 bytes, and patterns match case-sensitively, as git does by default on Linux.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-SECRET-011.md: the page then shows that text, with the registry reference appended under it.