When AI Coding Tools Leak Credentials: How Authorization Rules Expose Secrets and How to Contain the Damage
Security researchers have disclosed incidents where credentials stored in AI coding tools' local configuration files—plain-text passwords, API keys, and access tokens—were committed to public code repositories. This article explains why "allow and don't ask again" authorization records can capture secrets, how git ignore-rule gaps let them spread, and the concrete detection and remediation commands you can use to protect your repositories.
1. Incident Background and How to Verify It
Public reporting shows that security researchers disclosed a credential leak tied to the local configuration of AI coding tools. Some developers stored plain-text passwords, API keys, and access tokens in local configuration files, and those files were later committed to public code hosting platforms, affecting multiple repositories.
The root cause was the simultaneous failure of two layers of protection. The first layer failed because local storage was not sanitized. The second failed because version-control ignore rules did not reliably take effect. Configuration files should have been excluded from commits; once the ignore rules were missing or broken, sensitive content made its way into public repositories.
According to public reports, the relevant vendor stated it is researching preventive measures and working on fixes—check the vendor’s own announcements for current status. The incident data comes from public reporting, and different sources may use different counting methods. Before citing any figures, verify the publishing organization, publication date, and methodology in the original report.
2. Why Authorization Records End Up Storing Secrets
Before executing a shell command, AI coding tools typically ask the user for confirmation. If the user selects “Allow, and don’t ask again,” the tool writes this rule into a local configuration file, after which similar commands run automatically. Where the rule is written depends on the tool version and settings—it may live in the project directory or in a user-level configuration directory. Always confirm the exact behavior against the official documentation of the tool you use.
The problem lies in the rule’s content: the authorization rule stores the command verbatim. If the command directly contains a password, token, or key, those strings are written into the configuration file as-is. The following structure is illustrative only—it does not represent the real format of any specific tool, and the token is a placeholder:
{"allowed_commands": ["curl -H \"Authorization: Bearer <EXAMPLE_TOKEN>\" https://api.example.com/v1/reports"]}
This mechanism has three flaws.
First, commands are stored without sanitization. The tool records the complete, directly executable command without identifying credential parameters or replacing them with placeholders. Once a command contains a real key, the recording behavior itself creates a leak point.
Second, there is no separation between authorization convenience and data sensitivity. The rule exists to reduce repeated confirmations, yet it persists context containing sensitive information in a local file.
Third, protection depends on manual upkeep. Configuration files should be covered by ignore rules, but those rules are typically configured manually by developers. When a rule is missing or broken, the protection silently fails—and developers often don’t notice right away.
The more often users click “don’t ask again,” the more sensitive content accumulates in the configuration file. The risk grows steadily over time.
3. How Credentials Spread to Public Repositories
The coverage of ignore rules determines how far the leak spreads. There are three common paths.
Path 1: Global rules and project rules are inconsistent. Someone writes the ignore rule only in their personal global settings. When the project is cloned to another machine, the new environment lacks that rule, and the configuration file lands in the pending-commit list. To check, run git check-ignore -v <config file path>—it prints the matching ignore rule. No output means the file is not being ignored.
Path 2: A plain directory is later initialized as a repository. A developer first uses the tool in a folder that isn’t under version control, then runs git init. The existing configuration file gets swept into the initial commit. To check, run git add -n .—the -n flag only previews which files would be staged, without actually staging anything.
Path 3: The tool modifies or commits changes automatically. Some reports indicate that tools sometimes modify settings files without user confirmation, or even commit the changes directly, bypassing the developer’s pre-commit review. To check, run git log --name-only -n 20 to review files touched by recent commits, paying close attention to changes in configuration directories.
Additionally, ignore rules only apply to untracked files. If a configuration file was committed in the past and an ignore rule is added afterward, the file remains tracked and future modifications will still be committed. Run git ls-files to list tracked files, locate configuration files, then run git rm --cached <file path> to untrack them. This command only removes the file from the index; the file itself stays on disk.
