Settings files that Claude Code users committed to their git repositories carried passwords and API keys from terminal commands straight to GitHub. The issue stems from the tool's 'Yes, don't ask again' shortcut: the approved command is written as a permanent permission to a local file, and the contents of the command — including any embedded credentials — go into that file as plain text. Credentials have been found this way in thousands of public repositories.

What happened?

Claude Code is an AI coding agent that runs from the terminal; it can execute commands on the user's behalf, such as deleting files, installing packages, or making API calls. It asks for approval before every risky command, but if the user checks the 'don't ask again' option, that command pattern gets saved as a permanent permission in a settings file inside the project. If the command contains a token, password, or API key, that information gets written into the same file. Because the file isn't on the .gitignore list, developers commit it without noticing, and once the project is pushed to GitHub, the passwords become public along with it.

Why does it matter?

This isn't a new category of vulnerability — it's an old problem transplanted onto AI agents. GitHub has been scanning for AWS keys and database passwords written into .env files for years, which is why it rolled out secret scanning and later push protection. In that scenario, the mistake was human: a developer typed the password into the code by hand and committed it. The difference with Claude Code is that it's the tool itself writing the password into the file, not the user. The user just clicks an approval button and never sees what gets written to the file. That makes the problem harder to notice — the developer thinks, 'I never wrote the password anywhere.'

The real conflict lies in the design philosophy of agent tools. Not requiring approval for every single command speeds up the developer experience, but it offloads the security decision onto user discipline. It's the same logic as configuring passwordless sudo privileges or checking 'remember me on this device' in a browser: convenience in the short term, loss of oversight in the long term. Similar agent tools like Cursor, GitHub Copilot, and Replit Agent also keep some form of memory for command approvals — this isn't a code bug unique to Claude Code, it's a problem rooted in the very idea of permission memory.

Who does this affect, and how?

The biggest risk falls on individual developers doing rapid prototyping, and on open-source or hackathon projects. These users typically don't have extra layers of protection like private repositories, secret scanning, or a corporate security team — the repository sits directly on public GitHub. The risk is relatively lower for corporate teams, since push protection and private-repo scanning usually catch this kind of leak at commit time. But push protection doesn't catch everything either: it recognizes credentials in known formats (like cloud provider keys or payment API keys), but it often won't recognize a random database password or a custom token.

What's next?

Anyone using Claude Code should first check the settings files in their .claude/ folder to see whether any saved commands contain passwords. More importantly, if the file has already been committed, simply deleting it isn't enough — it still exists in the git history, so every exposed credential needs to be rotated immediately. In the medium term, the expected fix is for agent tools to automatically scan for passwords and keys before writing approval files, masking any detected values before saving. Leaving this to user discipline just means the same leak will happen again.

It's easy to pin the blame on a single button, but that's not where the real source lies: equipping an agent with the authority to make decisions on a user's behalf and then saying 'be careful' simply bills the design flaw to the user.