SI Agent NewsRumors
RumorClaudeleakWidely reported · Likely

GitLab identifies over 104,185 public repos with Claude Code secret leaks

A configuration file used by Anthropic's coding agent can inadvertently commit private tokens to public repositories if not properly excluded.

First reported 2026-11-07 · last seen 2026-11-11 · 4 outlet(s) · our article 2026-11-22

What we know

This is not confirmed. It was reported by about.gitlab.com.

The short version

The source of the leak

Anthropic's coding agent, Claude Code, allows developers to streamline their workflow by approving shell commands. When a user selects the option to run a command without asking again, the agent saves that specific command into a file named .claude/settings.local.json within the project folder.

The security issue arises because Claude Code only adds this file to a developer's personal global git configuration. This means the exclusion stays on the individual's laptop rather than being recorded in the project's .gitignore file. Consequently, the file can be committed and pushed to remote repositories where it becomes visible to others.

As Apiiro reported in early November 2026, this behavior led to 104,185 copies of the settings file appearing in public repositories. While many were empty, at least 1,122 of these files contained active secrets. Additionally, hundreds of other secrets remained exposed in the commit history of files that had since been deleted.

How the leak occurs

The file structure of .claude/settings.local.json is designed to store permissions for various bash commands. If a developer approves a command containing a sensitive element, such as a private token for a GitLab API, that exact string is written into the JSON file. For example, a curl command with a header containing a private token would be saved in plain text.

Because the file is not part of the project's standard ignore list, it travels with the repository to any host. This creates a significant risk for teams using Claude Code who do not have centralized controls in place. The leak is not a bug in the agent's logic but rather a mismatch between how the agent handles local permissions and how Git handles repository-wide exclusions.

GitLab confirmed that its own infrastructure secrets remain protected from this specific issue. However, the risk remains high for third-party developers who may inadvertently share their credentials. The platform is now highlighting the need for group owners to implement manual overrides to ensure these files are blocked from being pushed to the cloud.

Layers of defense

GitLab suggests a four-layer approach to prevent these files from reaching public servers. The simplest method is adding .claude/settings.local.json to the .gitignore file of every repository. For larger organizations, GitLab Premium and Ultimate users can add this line to group file templates so that every new project inherits the protection automatically.

For stricter enforcement, group owners can set a push rule to block the specific filename. This rule rejects any push attempt that includes the file in the root or any subdirectory, providing an immediate error message to the developer. For even deeper security, Ultimate users can enable Secret Push Protection, which scans the content of every push for known token formats regardless of the filename.

The final layer involves a scan execution policy that runs GitLab Secret Detection on every pipeline and on a weekly schedule. This policy can be configured to look through the entire repository history. By using the SECRET_DETECTION_HISTORIC_SCAN variable, administrators can ensure that even old, deleted secrets are identified and flagged for rotation.

Assessing the damage

Once protections are in place, developers must determine if they have already been compromised. GitLab Duo users can use Agentic Chat to query their entire group for any project that has ever contained the .claude/settings.local.json file. This tool can identify which projects have the file now and which ones had it in the past, even if it was later deleted.

Users without GitLab Duo can perform a manual search using the code search tool. By using specific regular expressions for the filename and path, they can find current copies across their groups. However, search tools often miss files that exist only on certain branches or those that have been deleted from the default branch.

To find deleted files, developers must use the commits API to check the history of every project. This process is necessary because a deleted file still contains the secret in the repository's history. This check also helps identify forks, as each fork maintains its own unique history and may contain its own copy of the leaked file.

Mitigation and purging

The recommended order of operations for handling a leak is to rotate, then remove, and finally purge. Developers must treat every secret ever held in the file as public from the moment it was first committed. This means the secret must be invalidated and replaced at the provider level before any files are deleted or moved.

GitLab Duo can automate the removal process by opening merge requests across a group to delete the file and update the .gitignore. Without this automation, developers must manually run commands to remove the file from the cache and commit the change. This ensures the file is no longer tracked by Git in the current working directory.

The final step is purging the content from the repository history. This is done through repository maintenance by removing the specific blobs associated with the old versions of the file. After the rewrite, developers must prune unreachable objects to ensure the secret is completely purged from the server's storage.

Why it matters

Developers using AI coding agents may unknowingly expose private API keys or tokens to the public internet. This guide provides a systematic way for organizations to audit their entire repository history and automate the cleanup process.

What to watch

Sources