Anthropic Claude Code Tool Leaks Secrets into Public GitHub Repositories

Security investigations have revealed that developer credentials entered during automated workflows with Anthropic's Claude Code assistant are being leaked to public repositories. When engineers approve suggested commands using specific persistent confirmation settings, the system saves the entire command string directly into project-level configuration files. Because these files are frequently committed to version control systems without adequate exclusions, sensitive API tokens and credentials are left open to public observation.
Exposure Details
According to an analysis conducted by software security firm Apiiro, the issue stems from the persistent approval workflow within the tool. When a developer selects the option designed to approve an execution without future prompts, Claude Code writes the literal command into a settings file named .claude/settings.local.json. Crucially, the tool does not automatically register this specific file in the project's .gitignore configuration, meaning the file does not inherently gain local exclusion rules when pushed to remote hosts.
Industry Context and Precedents
This behavior contrasts sharply with standard architectural patterns observed across competing coding companions. In a comparison involving 16 separate coding assistants, Claude Code was the sole agent confirmed to store full approved commands within a project file by default. This design choice amplifies repository exposure, especially in collaborative or public coding environments.
Persistent leaks remain an active target for automated harvesting operations. For example, during attacks associated with the Shai-Hulud worm in September 2025, infected machines were scanned and more than half of inspected files were flagged for exposed secrets. In the case of Claude Code, the exposure window has been substantial: as of Monday, every identified file holding credentials remained on the default branch of its repository, with half of them present online for at least 217 days.
Recommended Mitigation Steps
Security specialists urge engineering teams utilizing Claude Code to immediately inspect their version control trees for the exposed settings path. Because historical commits preserve recorded strings even after file deletion, researchers recommend developers rotate all passwords, tokens, and keys that have ever been held in these files before carrying out cleanup operations on the repositories.


