How AI Coding Assistant Approval Configs Leak Secrets: Risk Analysis and Remediation

    AI coding assistants often persist entire approved commands—including plaintext passwords, tokens, and cloud credentials—into local project config files after users select "don't ask again." This article analyzes how those files end up in public repositories, why secret scanners miss them, and provides concrete remediation steps from key rotation to CI gating and vendor evaluation.

    1. How a Convenience Feature Became a “Secret Vault”

    A security research team recently scanning public code hosting platforms found that certain AI coding tools, after a user chooses “don’t ask again,” may write the complete approved command line into a local configuration file inside the project. The problem is not that the tool “remembers approvals”—it’s the granularity of what it remembers. If the full command contains a plaintext database password, access token, remote login credential, or cloud service key, that sensitive information gets persisted along with it.

    This doesn’t contradict the familiar security narrative of “encrypted keys in cloud sessions, invisible to the model.” It reveals risk in another direction: the cloud pipeline may be encrypted and isolated, but a local approval file can be committed into a repository, then publicly indexed, cloned, forked, and retained indefinitely. In other words, under certain configurations a convenience checkbox becomes a “secret vault,” and repository history makes simply deleting the file insufficient.

    The typical risk chain looks like this:

    1. A developer runs a command with sensitive parameters during debugging or deployment;
    2. The tool asks whether to allow it and remember the command;
    3. The user selects “don’t ask again,” and the full command is written to a project-local config file;
    4. Local global exclusion rules only protect the current machine and don’t propagate with the project;
    5. The project-level ignore rules don’t cover the file, so it gets committed;
    6. Scanners, crawlers, or manual review on public hosting platforms discover the secrets;
    7. Even after the file is deleted, repository history, forks, and agent logs may still retain copies.

    The key lesson: a security boundary cannot rest on the assumption that “the file is local.” As long as a file lives inside a project directory, it can be accidentally committed, overwritten by shared configuration, or packaged and uploaded by automated tooling.

    2. Scale of Exposure: From Thousands of Keys to Thousands of Repositories

    According to the research team’s disclosure, roughly 104,185 relevant local config files exist on public platforms; about 1,122 of them contain at least one secret, totaling approximately 1,379 distinct secrets. Broadening the scope to include repository history, shared config files, agent run logs, and forked repositories, the estimate rises to about 2,539 secrets across roughly 1,994 repositories.

    More alarming is the distribution of secret types: more than a third are direct database passwords—about 379—along with remote login credentials, cloud service access keys, and others. A working database password can let an attacker read, modify, or export business data; cloud credentials can be used for resource manipulation, data access, or cost consumption. The team did not verify whether every secret was still valid, but one notified company confirmed its key had been usable—so this is not merely a theoretical risk.

    Timing matters too: for about half of the affected repositories, the leaked content had existed on the default branch for at least 217 days. The longer the exposure window, the higher the probability of automated scanning, malicious crawling, and re-propagation. Many teams only delete the current file upon discovery, ignoring the default branch, historical commits, forks, and local copies—resulting in a fix that is cosmetic rather than real.

    Blind spots in scanning deserve attention. Two common secret-scanning tools flagged only 564 and 643 files respectively, and about 215 files were missed by both. Possible causes: non-standard key formats, complex command context, deeply nested config files, insufficient scanning rules, and historical commits that were never fully scanned. No single scanner should be treated as the only line of defense.

    3. Why Local Configs Bypass Protections

    The core mechanism is “full command persistence.” From a security design standpoint, approval memory should record “capability patterns” rather than raw commands containing secrets. Recording “allow the status subcommand of a deployment tool” is far safer than recording “allow the full deployment command containing a plaintext password.” The former expresses least privilege; the latter bakes the secret into the config.

    Local global exclusion rules protect only the current development machine. They are not written into the repository’s own ignore rules, so the protection doesn’t travel with the project. Switch machines, developers, or CI environments, and the protection may vanish. Project-level ignore rules must be committed with the project so that everyone who clones it shares the same security baseline. Many teams rely only on personal global settings, so these local config files slip through code review unnoticed.

    Repository history is the second difficulty. A file that was once committed is not erased from history just because it was removed from the current branch. Historical commits can be cloned, cached, mirrored, and forked. For public repositories, history can be searched indefinitely; for internal ones, history may be synced to analytics platforms, backup systems, or third-party build environments. So the correct remediation order is “rotate the keys first, then clean up the exposure”—not spending days rewriting history while continuing to use the same keys.

    The contrast between cloud-side encryption and local commit incidents is clear: cloud security capabilities address transport, storage, and model visibility; local approval files address developer convenience. These are different trust boundaries. The fact that the cloud side encrypts does not make local config files safe, and the fact that a local file is ignored does not make historical commits safe.

    4. Illustrative Configuration: Dangerous vs. Safer Patterns

    The following are illustrative pseudo-configs, not any specific product’s interface, intended only to show the difference between “full command persistence” and “capability-pattern authorization.”

    Dangerous pattern:

    1. {
    2. "approvals": {
    3. "allow": [
    4. "deploy-service --db-password=PLAINTEXT_DB_PASSWORD",
    5. "request-service --access-token=PLAINTEXT_ACCESS_TOKEN"
    6. ]
    7. }
    8. }

    Safer pattern:

    1. {
    2. "approvals": {
    3. "allow": [
    4. "deploy-service status:*",
    5. "deploy-service deploy --target=staging"
    6. ],
    7. "deny": [
    8. "deploy-service deploy --db-password=*",
    9. "request-service --access-token=*"
    10. ]
    11. }
    12. }

    The safer approach is to never put secrets in command-line arguments; instead, inject them via environment variables, short-lived credentials, or a general-purpose secrets management service. Approval rules should authorize by executable and subcommand prefix, and deny whole commands containing passwords, tokens, private key paths, or other sensitive patterns. Command-line arguments can leak into process listings, logs, config files, and shell history—so “writing the password into the command” is itself a high-risk habit.

    5. Remediation and Governance: From Personal Habits to Enterprise Controls

    First, rotate the keys. Upon discovering leaked configuration, immediately assess the validity of database passwords, cloud credentials, remote login credentials, and access tokens; rotate them following least privilege, and check for anomalous access. Don’t wait for history cleanup before rotating—the keys may already have been copied during the exposure window.

    Second, add the local config file to repository-level ignore rules and commit those rules. Relying only on machine-level global exclusion is insufficient; repository-level ignore rules are the only ones that propagate with the project. Code review should specifically check whether local config files, shared config files, and agent logs were accidentally committed.

    Third, remove the file from version control indexing while keeping a local copy, and evaluate whether history cleanup is needed. History cleanup requires coordinating with the team, mirrors, forks, and build caches. If the keys have already been rotated, history cleanup mainly reduces information exposure rather than serving as the sole remediation.

    Fourth, tighten approval policies. Prefer command-prefix patterns, read-only subcommands, and least-privilege credentials; prohibit plaintext secrets in commands, config files, and logs. Apply stricter approval to high-risk commands such as deployments, database operations, and cloud resource actions.

    Fifth, add pre-commit and historical scanning to CI pipelines. Scanners should cover config files, command arguments, logs, nested structures, and multi-branch history. When a single tool misses findings, use multiple engines for cross-validation. Block merges on high-risk hits and notify the responsible parties to rotate.

    Sixth, establish a vendor evaluation checklist. Does the AI coding tool persist full approved commands by default? Does it offer redaction? Does it write project-level ignore rules? Does it support auditing and policy enforcement? Do its logs contain sensitive parameters? Reviewing documentation across a dozen similar tools, the research team found that only this class of tools persists full approved commands into project files by default—evidence that procurement and security review must examine local configuration behavior, not just model capability.

    Seventh, invest in developer education. Most leaks are not malicious; they’re unconscious commits behind a convenience checkbox. Teams should make explicit rules—“never approve commands containing secrets, never commit configs containing secrets, rotate keys first upon discovery”—and integrate secret scanning, ignore rules, and least privilege into everyday development workflows.

    6. Conclusion

    The value of this incident lies not in any single vulnerability but in a reminder: the convenience of AI coding assistants changes where secrets land on disk. Cloud encryption secures the cloud trust boundary, while local approval files bring risk back into the project directory and version history. Governance should revolve around four principles: secrets never in commands, configs never in repositories, history never hiding hazards, and rotation upon discovery. Only by incorporating convenience features into the security baseline can teams improve development efficiency without turning a “secret vault” into a public leak source.