AI Security
Claude Code Exposed Thousands of Secrets Through Misconfigured Permission Files
Security researchers uncovered a flaw in how Claude Code stores developer approvals, leading to widespread credential leaks across public repositories.
InfoQ
Claude Code, Anthropic's agentic coding tool, has been inadvertently exposing sensitive credentials in public repositories due to a design flaw in how it implements approval permissions. Security researchers at Apiiro identified thousands of leaked secrets, prompting warnings from multiple security firms about the broader risks of AI coding agents.
The Leakage Mechanism#
When developers approve a shell command with "Yes, and don't ask again," Claude Code saves that authorization as a permanent rule in a local configuration file called .claude/settings.local.json. The problem: this file often ends up containing embedded credentials, API tokens, and passwords that developers included in their command approvals.
Apiiro's investigation found 1,122 exposed secrets in these local settings files, plus another 1,160 spread across git history and agent chat transcripts. The leaked credentials ranged from cloud API keys to production passwords and npm tokens, affecting 63 organizations.
A follow-up analysis by GitGuardian revealed 31,088 additional secrets in the same files on public GitHub, with over 5,300 still valid at the time of detection.
Why Git Ignore Fails#
Claude Code attempts to protect these files by adding them to developers' global .gitignore list—but this strategy has significant gaps. The settings file isn't added to the repository's own .gitignore, so it doesn't travel with projects to new machines or when repos are cloned. If a folder becomes a git repository after Claude Code creates the settings file, or if the file is already committed, the protection never kicks in. In some cases, Claude Code itself committed the file to repositories.
Detection Gaps#
Standard secret-scanning tools like gitleaks and TruffleHog struggle to catch these leaks because credentials are embedded inside shell command strings rather than appearing in isolation. The same pattern—passwords hidden within commands—repeats across transcripts, memory files, and handoff notes, making detection difficult.
Systemic Risk#
Researchers noted that consolidating secrets in a single, predictable location represents a fundamental security risk. As one analysis put it, the settings file amounts to "a list of the systems the developer can reach and the passwords that open them, one file search away"—and malware would know exactly where to look.

