AI coding assistants are meant to make software development faster and easier, but they can also create serious security risks. A recent investigation by Apiiro found 2,539 credentials across nearly 2,000 public GitHub repositories. These included database passwords, cloud access keys, API tokens, and SSH root logins. Researchers linked many of the exposures to Claude Code, an AI coding agent that saved sensitive commands and credentials in a hidden local settings file, which was later committed to public repositories.
The issue begins with a routine developer action. When a developer asks Claude Code to perform a task, such as checking a database or using an API, the suggested command may contain a secret from a configuration file. If the developer chooses “Yes, and don’t ask again,” the tool saves that command, including its credentials, to .claude/settings.local.json within the project folder. The file is designed to store local settings, but it can also become a storehouse of highly sensitive information.
Hidden Files, Major Risks
Claude Code does include a protective measure. It adds the settings file to the developer’s global Git ignore list, which prevents the file from being committed on that specific computer. However, this rule is not added to the repository’s own .gitignore file. Therefore, it does not follow the project when it is cloned to another machine. A developer working on a different computer may unknowingly commit and push the credential-bearing file to GitHub.
Apiiro analyzed 104,185 publicly accessible copies of .claude/settings.local.json on GitHub. It found that 1,122 files contained real secrets, with 1,379 distinct secrets in total. These included 636 provider-specific keys and 743 passwords or tokens linked to public hosts. The exposed credentials were not limited to harmless test values; researchers found an admin-level cloud key belonging to a database vendor, a production Azure Postgres password, a Square production token, and the owner password for a medical-records database.
The danger is amplified because developers may not realize they approved the credential-saving action. A “don’t ask again” prompt can seem like a simple convenience, but it may write a secret into a file that the developer does not know exists. Once that file reaches a public repository, attackers could potentially use the exposed credentials to access cloud services, databases, payment platforms, or internal systems. The incident also shows that AI-generated artifacts, such as agent settings and command histories, must be treated as sensitive data alongside source code.
Organizations should update their security practices to address this new risk. They should include AI-agent folders in pre-commit checks and secret-scanning processes, and they should scan repository history as well as current files. Developers who may have used affected workflows should rotate every credential that could have appeared in a settings file, even if the file was never committed. They should also inspect all fields and delete any rule containing a secret. Anthropic has said it is exploring safeguards, including improved auto-mode detection and built-in secrets scanning, for future versions of Claude Code.