Claude Code Configuration Flaw Exposes Secrets in Public Repositories

Claude Code Configuration Flaw Exposes Secrets in Public Repositories

How Local Configuration Files Trigger Data Exposure

Security firm Apiiro has discovered that the AI programming assistant Claude Code exposes sensitive credentials in public repositories. The issue stems from the «Yes, and don’t ask again» option, which developers use to authorize terminal commands automatically. Selecting this setting saves a permanent rule inside the local configuration file .claude/settings.local.json, which can capture passwords, tokens, and API keys.

When generating this file, the tool only adds the path to the user’s global Git ignore settings rather than the repository’s local .gitignore. As a result, the exclusion rule does not travel with the project if it is shared, cloned on another system, or converted into a repository at a later stage. Researchers also noted instances where Claude Code itself committed the sensitive file directly to version control.

Thousands of Valid Secrets Identified in Public Code

Apiiro initially uncovered 1,122 secrets in configuration files and an additional 1,160 in Git commit histories, shared configurations, and agent interaction logs, impacting 63 organizations. The exposed records included cloud service credentials, npm access tokens, and production environment passwords.

Further investigation by cybersecurity company GitGuardian expanded these findings, identifying 31,088 secrets tied to this Claude Code file on public GitHub repositories. Of those, 5,343 remained active and valid during the study, along with 613 found in Docker Hub images. Additionally, standard scanning utilities such as gitleaks and TruffleHog failed to flag many of the credentials because they were embedded inside command-line strings.

Recommended Mitigation Steps

Security teams advise engineering groups to implement the following actions:

  • Untrack the file: Remove the configuration file from version control by executing git rm –cached .claude/settings.local.json.
  • Update repository ignore lists: Manually append the file path directly to the project’s .gitignore.
  • Rotate exposed credentials: Immediately revoke and replace any keys or passwords that were stored in the configuration file.
  • Rely on environment variables: Clean up stored command rules and reference environment variables instead of entering raw secrets in the console.

What this means for your business

For small and mid-sized enterprises, this security alert highlights that incorporating AI coding assistants can inadvertently expose cloud infrastructure and production secrets if automatically generated configuration files are not audited. Companies must ensure their development teams use environment variables and inspect local files prior to pushing code, especially since conventional security scanners often fail to spot secrets nested within terminal commands.

Source: InfoQ · November 22, 2026

Text and illustration prepared with AI assistance and reviewed by the AFC IT Solutions team.