Software · 10 November 2026 · 4 min read
A Shortcut in the Terminal: How Claude Code Leaked Thousands of Secrets Across GitHub
In brief: A cybersecurity investigation conducted by Apiiro revealed that Anthropic's CLI developer assistant, Claude Code, inadvertently exposed sensitive credentials across GitHub. The issue stems from a local settings file that records user-approved shell commands in clear text alongside database passwords and API tokens. Because gitignore rules were applied only at a global level rather than per repository, sensitive files ended up published online across thousands of corporate projects.
by Team Mocchi's
When an agentic tool promises to remove the burden of repetitive terminal tasks, a developer's most natural reaction is to click «approve and do not ask again». Yet behind this seemingly harmless convenience lies a significant data leak that left thousands of corporate credentials exposed across public GitHub repositories.
The vulnerability was detailed by cybersecurity firm Apiiro, whose findings show that a local settings file generated by Claude Code—Anthropic's command-line programming agent—has been systematically leaking access tokens, database passwords, and root credentials onto the public web.
An authorization saved without sufficient safeguards
The root cause lies in Claude Code's standard approval flow. Whenever the agent attempts to run an automated shell command, users are prompted with a «Yes, and don't ask again» option to streamline future runs without repeated confirmation dialogs.
To persist that choice, the tool writes a rule into a local .claude/settings.local.json file. While the rule is sometimes abstracted into a generic pattern, the command itself is frequently stored verbatim. This includes every parameter supplied in the shell: database connection strings, bearer tokens, and private API keys passed as CLI arguments.
On a single isolated computer, storing these commands locally does not represent an immediate breach. The danger arises as soon as those files slip into Git source control.
The breakdown in the gitignore chain
As reported by Ars Technica, Anthropic's official documentation notes that .claude/settings.local.json is automatically appended to the developer's global .gitignore file. Under ideal circumstances, this prevents Git from ever tracking the file.
However, that rule is not mirrored at the repository level. If a project is cloned onto a secondary workstation without identical global settings, if an existing folder is turned into a Git repository later on, or if the global configuration fails to match the path, the sensitive file is committed. Even worse, Apiiro discovered that in numerous instances, Claude Code itself initiated automated Git commits that included the local configuration file without requiring explicit user approval.
Over a hundred thousand exposed files and ignored bug reports
The scale of the exposure is substantial. Apiiro discovered over 100,000 instances where Claude Code's local settings file was uploaded to public GitHub repositories. Among those, around 1,100 files across 63 distinct organizations contained active, high-value secrets, including private encryption keys, cloud infrastructure credentials, and live production databases.
The distributed structure of Git compounds the issue. Once a public repository is indexed or forked, merely deleting the configuration file does not scrub the secret from commit histories or downstream mirrors, leaving it vulnerable to automated credential scanners.
The incident is further complicated by past warnings: the behavior had been raised in Claude Code bug reports as early as August 2025. Multiple tickets pointed out that sensitive files were failing to stay excluded from version control, yet these issues were automatically closed after 60 days of maintainer inactivity. On Hacker News, Claude Code lead Boris Cherny acknowledged that the team is exploring mitigations, while noting that settings files were never designed to be checked into source control.
Mocchi's take
The Claude Code leak highlights that the primary security risk in coding agents rarely stems from model hallucinations, but rather from friction points between automation and real developer workflows. Delegating shell execution without ironclad secret boundaries leaves critical infrastructure open to trivial yet devastating breaches. For companies adopting or building agentic software pipelines, the takeaway is clear: credentials must never be passed in clear text shell commands, and robust pre-commit hooks paired with centralized secret managers must be enforced at the repository level before trusting any commercial agent with local terminal access.