Skip to the cards
Filed
Source
Joseph Miller
Loans
489

Claude Code Approval Rules Exposed 31,088 Secrets in GitHub and Docker Images

GitGuardian found thousands of credentials in Claude Code settings files. Teams should check repositories, container images and exposed credentials.

Claude Code Approval Rules Exposed 31,088 Secrets in GitHub and Docker Images

Claude Code’s “Yes, and don’t ask again” approval option can leave credentials in a project configuration file. GitGuardian found 31,088 distinct secrets in Claude Code’s .claude/settings.local.json files across 23,276 public GitHub repositories. Of those, 5,343 were still valid when detected. The findings also include credentials in public Docker Hub images, where removing a file from a repository won’t remove copies already distributed in images.

For IT teams, the risk sits in a workflow that can feel routine: approve a command once, then let the coding assistant run it again without asking. If that command contains a password or token, the saved approval rule can preserve the secret in a file that developers may later share, commit or include in a container build.

Approval rules can preserve full commands

Claude Code asks developers for permission before running certain shell commands. Selecting “Yes, and don’t ask again” saves an allow rule in .claude/settings.local.json, a project-level configuration file. According to GitGuardian researcher Guillaume Valadon, the rule can contain the command itself, including credentials embedded in it.

Consider a developer who approves a curl request that passes an API key in an HTTP header. The approval rule can retain that full command string. The key may then sit in the settings file alongside the project’s other local configuration, even though the developer’s intent was simply to avoid repeated prompts.

Claude Code automatically adds the file to its local Git ignore settings. That reduces the chance of an accidental commit in the same working copy, but the protection may not follow the file to other machines or repositories. A developer working across multiple clones could encounter different ignore settings; a file that is already tracked can also remain under version control despite a later ignore rule.

GitGuardian identified a range of exposed credential types, including database connection strings, cloud provider tokens, SSH passwords, Google API keys and AU service credentials. Among the credentials for which it could establish validity, 67% were working. Database identifiers made up the largest category of valid secrets, at 2,280 distinct credentials, followed by cloud provider tokens and AI tokens.

The monthly number of leaks in settings.local.json peaked at 12,535 occurrences in April 2026 and fell to 959 by October. Valadon said GitGuardian did not yet know what had changed. Those figures describe detected occurrences over time; they don’t establish why the count declined or whether the same pattern applies to private repositories.

Container builds create another route to exposure

GitGuardian found 613 distinct secrets in Claude Code settings files within public Docker Hub images. Ninety-nine were valid when detected. The files appeared across 543 image repositories and 7,625 tags.

The exposure can happen when a Docker build copies an entire project working directory into an image. Git uses .gitignore to help keep selected files out of version control, but Docker doesn’t automatically apply those rules to build context. A settings file excluded from a Git commit can therefore still be copied into an image unless developers exclude it with .dockerignore.

The scale of repeated exposure was visible in two examples described by Valadon: one valid Cloudflare API token appeared across 559 image tags, while a database password appeared in 643 tags across seven image repositories. Tags can make one credential visible in multiple published image versions, so deleting a file from the current working tree won’t address every copy that may already have been built and published.

For administrators responding to a suspected leak, the practical work has several parts. Identify which credentials appeared in the settings file or image, rotate credentials that were exposed, and remove sensitive configuration files from both Git tracking and Docker build contexts. Teams should also check previously published images, since changing the repository alone doesn’t remove secrets from image layers or tags that remain available.

Secret scanners may miss command-line credentials

Conventional secret scanning can overlook some of these cases. Passwords placed in command-line arguments or environment variable assignments may not match the recognizable formats that provider-specific detection rules seek. That makes file location and workflow relevant to detection: a scan focused on conventional environment files may not catch a credential preserved inside an approved command.

GitGuardian recommends treating AI coding assistant configuration files as potential secret-bearing assets, scanning them alongside conventional environment files, and using environment variables instead of hardcoding credentials into commands. For teams using Claude Code across shared projects, the settings file deserves a place in repository and container build reviews, especially when developers approve commands that authenticate to databases, cloud services or APIs.

Anthropic had not immediately responded to a request for comment. GitGuardian said Claude Code lead Boris Cherny acknowledged the issue and said the company was looking into it and exploring additional safeguards, including built-in secret scanning and an auto mode. Until those safeguards are available, teams can reduce exposure by checking existing settings files and published images, then reviewing how local approval rules enter their build and sharing workflows.

Source: Joseph Miller · www.infoworld.com

Filed alongside