NEWS

5 min read

Claude Code Exposed Thousands of Credentials Because of the "Don't Ask Again" Feature

Claude Code Exposed Thousands of Credentials Because of the "Don't Ask Again" Feature
Image: Redação iMasters
News
Reading
5 min
In short

Research from Apiiro and GitGuardian found tens of thousands of secrets exposed in public repositories because of how Claude Code saves permissions for approved commands.

A study by security firm Apiiro, released on November 22, 2026, found exposed credentials in public repositories because of how Claude Code stores command permissions in the "Don't Ask Again" feature. The issue affects people who use Anthropic's coding assistant on a daily basis and exposes API tokens, production passwords, and cloud credentials that end up version-controlled without the developer noticing.

Apiiro identified 1,122 secrets in the .claude/settings.local.json file spread across repositories on GitHub, plus another 1,160 secrets in git history, in settings.json files shared and intentionally committed by the team, and in agent conversation transcripts saved inside the repositories themselves. In total, 63 organizations were affected, according to the survey.

The case matters especially for teams in Brazil that have adopted Claude Code as a terminal copilot in recent months: the tool gained traction among backend and DevOps squads precisely because of its promise to run commands without friction, and it's exactly that removed friction (automatic command approval) that becomes a risk when the command carries a password.

How "Don't Ask Again" Becomes a Leak

The feature exists to prevent Claude Code from repeatedly asking whether it can run the same shell command. When the developer replies "Yes, and don't ask again" to approve an action, the tool saves that approval as a permanent permission rule inside .claude/settings.local.json, in the project directory.

The problem is that many approved commands carry the credential embedded right in the text, such as a deploy command with an API key typed directly into the command line. When saving the rule, Claude Code saves the entire command, secret included, in a local file that doesn't always stay outside version control.

The tool tries to protect itself by adding the file to the developer's global .gitignore when it creates it inside an existing git repository. But this protection has gaps, as Apiiro points out:

When [Claude Code] creates the file inside a git repo, it adds it to the developer's global git ignore list. That covers the common case. It doesn't cover a folder that becomes a repo later, a clone on another machine, or a file someone already committed. The rule never goes into the repo's own .gitignore, so nothing travels with the project to protect it.

Apiiro researchers, report on Claude Code

In some cases, the researchers found Claude Code itself committing the file directly, without developer intervention.

A Ready-Made Map for Anyone Who Wants to Break In

Since the file always sits at the same path in any project, it becomes an obvious target. According to Apiiro, any malware that searches for .claude/settings.local.json finds, in a single file, the list of systems that developer can access and the passwords that open those systems, just a search away.

The types of secrets found by the research include:

  • Cloud provider API keys
  • Production environment passwords
  • Access tokens for internal systems
  • npm tokens

GitGuardian Confirms and Expands the Scope

Apiiro's findings were reinforced by another security company, GitGuardian, which scanned public GitHub for the same file. The result: 31,088 secrets found in publicly exposed .claude/settings.local.json files, of which 5,343 were still valid at the time of detection. The company found another 613 secrets of the same type embedded in images published on Docker Hub.

GitGuardian had already been warning about this pattern before this specific case:

Cursor, Claude Code, and GitHub Copilot leave credentials scattered across config files, logs, and shell history.

GitGuardian, security report

Why Secret Scanners Don't Catch This

Popular detection tools, such as gitleaks and TruffleHog, failed to flag all the credentials exposed in this survey. The reason is structural: these scanners are trained to recognize the format of a key (a known prefix, a character pattern), not to read an entire shell command and identify that a piece of it is a password.

When the credential is embedded in the middle of a command, surrounded by flags and arguments, it escapes detection. In short: the same pattern of a password inside a command shows up anywhere an agent logs what it ran, whether in chat transcripts, memory files, or handoff notes between agents, and a scanner tuned for key formats misses it in every one of these cases.

What the Community Is Saying

The reaction in developer communities combines outrage with practical changes in habits. On Reddit, user T_Thriller_T summed up the general sentiment:

Somewhere, someone said AI companies are ignoring basic cyber security principles.

T_Thriller_T, Reddit user

Another user, MattV0, described a change that goes beyond fixing the specific file:

While this is about secrets, I totally stopped adding AI files into my projects. Means no settings, CLAUDE.md, AGENTS.md or anything else. I even turned off Claude's memory. [...] Nowadays I use a memory/task/docs server through mcp and it really improved such documentation issues.

MattV0, Reddit user

How to Protect Your Project Now

For those using Claude Code in real projects, Apiiro recommends a minimal sequence of immediate actions:

  1. Remove the file from version control with git rm --cached .claude/settings.local.json
  2. Add .claude/settings.local.json to the repository's own .gitignore, not just the global one
  3. Rotate every credential the file has ever contained, even if it has already been removed from history
  4. Manually open the file and delete any permission rule that contains an embedded secret
  5. Avoid typing secrets directly into approved commands, using environment variables such as DATABASE_URL or API_KEY instead of the literal value

For Brazilian teams that have adopted Claude Code in CI/CD pipelines or in squads that share configuration via settings.json, it's worth auditing old repositories: the exposure isn't a one-off bug in a specific version, it's a usage pattern that repeats as long as the practice of approving commands with "don't ask again" remains common. Running a secrets scanner helps, but doesn't solve the problem alone, because a good portion of these credentials stays invisible to generic market tools. As of this report's publication, the original reporting does not record an official statement from Anthropic on the issue.

Translated from the Brazilian Portuguese original · Read the original