AI Coding Assistant Leaks Secrets via 'Don't Ask Again' Feature, Exposing Cloud API Keys and Production Passwords
Agentic security firm Apiiro has uncovered a significant vulnerability in Claude Code, an AI coding assistant, where its "Don't Ask Again" feature inadvertently exposes sensitive information. When developers approve shell commands with the "Yes, and don't ask again" option, Claude Code saves these commands, potentially embedding credentials, passwords, and API tokens, into a local configuration file (`.claude/settings.local.json`). This file, intended for local persistence, has been found in public repositories, leading to the exposure of 1,122 secrets in these files and an additional 1,160 in Git history and chat transcripts.
This discovery is critical for practitioners because it demonstrates how seemingly innocuous convenience features in AI development tools can introduce severe security risks. The issue affects 63 organizations, with exposed secrets ranging from cloud API keys to production passwords and npm tokens. The problem is exacerbated by the fact that Claude Code's `.gitignore` handling is insufficient; while it adds the settings file to a global `.gitignore`, it fails to add it to the repository's `.gitignore`, meaning the file can still be committed under various scenarios, such as when a folder becomes a repository later or when cloned on another machine.
This incident fits into a broader trend of increasing security concerns surrounding AI-assisted development. As AI tools become more integrated into the software development lifecycle, the potential for new classes of vulnerabilities emerges. The rapid adoption of AI agents for coding, code review, and even automated vulnerability patching introduces complexities that traditional security practices may not fully address. The industry is grappling with how to secure AI-generated code and the tools that generate it, especially as AI models themselves can be vectors for new attacks or inadvertently leak sensitive data.
In practice, developers and DevOps teams must implement stricter secret management policies and enhance their code review processes, even for AI-generated or AI-managed configurations. Relying solely on generic secret scanners may not be sufficient, as these tools often fail to detect credentials embedded within shell commands or other non-standard formats. Organizations should consider implementing pre-commit hooks that scan for sensitive data, enforce strict `.gitignore` policies at the repository level, and educate developers on the risks associated with persisting credentials in any local configuration files, especially those managed by AI assistants. Furthermore, a defense-in-depth strategy that includes robust access controls, regular credential rotation, and continuous monitoring for exposed secrets across all code repositories is more crucial than ever.
Read original source