A Claude key in Git: GitHub blocks the push by default

GitHub blocks pushes containing Claude keys by default. How the protection works and how to keep LLM keys out of repositories and within budget.

  • A model key works like a corporate payment card
  • What GitHub released
  • Why a leaked model key costs money immediately
  • How push protection works

A model key works like a corporate payment card

On October 13, GitHub began blocking pushes containing Anthropic keys by default (GitHub Changelog). Secret scanning also detects Salesforce and Cloudsmith tokens. Companies using Claude for development and integration should pay attention. A model API key resembles a corporate payment card without a limit unless the team sets one.

Protect the key before it reaches the repository. Once it is there, the team can only revoke it and calculate the loss.

What GitHub released

GitHub released three updates on October 12 and 13.

All three concern control over secrets and AI development tools. - Secret scanning now recognises new secret types for Anthropic, Salesforce and Cloudsmith.

Push protection is enabled by default for Anthropic keys: GitHub rejects a push containing one until the developer removes it or explicitly bypasses the block. Salesforce joined the partner programme.

If GitHub finds a salesforce_marketing_cloud_api_oauth2_token in a public repository, it sends it to Salesforce for revocation or rotation. - Security overview shows AI Scan metrics for pull requests: new and resolved findings, remediation rate, repositories with the most problems and how often developers accept autofixes. - Copilot telemetry added the telemetry.capture.identity setting.

It adds three OpenTelemetry attributes: user.name, the GitHub login; process.user.name, the OS account; and host.name, the machine name. It does not collect prompts, responses or tool-call contents. It is disabled by default.

Why a leaked model key costs money immediately

  1. A leaked test-database password creates a risk that may never materialise.

  2. A leaked LLM API key starts spending money as soon as someone else finds it. Bots have scanned public commits for keys for years.

  3. Whoever finds a Claude or GPT key can use it for generation at your expense.

  4. Without provider-console spending limits and alerts, overspending is noticed only when the bill arrives or the balance runs out.

  5. Common leaks include committing .env files or leaving keys in Jupyter notebooks, MCP-server configuration or temporary scripts later added to a shared repository.

  6. Another scenario remains our hypothesis: an AI coding agent sees a key in its context and inserts it as a literal string to make a test pass.

  7. If the hypothesis is correct, more agent-written code will put keys in unexpected places more often.

How push protection works

  1. GitHub compares pushed content against known secret patterns.

  2. For some providers, GitHub also checks whether a discovered key is active.

  3. The critical property is when checking happens: GitHub blocks the secret before it enters history, so no Git-history cleanup is needed.

  4. History cleanup is expensive: the team rewrites Git history, force-pushes and has everyone recreate local clones.

  5. The key still needs rotation because copies may remain in forks, local clones and CI caches.

  6. The partner programme adds a second line of defence.

  7. If a key reaches a public repository, GitHub notifies the provider, which revokes it without your team’s intervention. This protection is limited to GitHub.

  8. Many CIS companies host code in self-managed GitLab or Gitea.

  9. There, equivalent protection uses a server-side pre-receive hook and gitleaks or trufflehog in CI.

  10. In our experience, basic setup takes about a day.

  11. This is a good example of TTU, time to use: the check starts blocking keys from the next push.

Assess where AI can deliver impact in your process

The metric that reveals the outcome

  1. Read AI Scan metrics carefully.

  2. Finding counts alone say little: a scanner reporting 400 issues may simply overwhelm the team with noise.

  3. Executives need two numbers. Remediation rate shows what share of findings the team resolves.

  4. The accepted-autofix share shows whether developers accept the AI’s suggested corrections.

  5. If the remediation rate does not improve, the scanner budget paid for reports.

  6. A company buys a scanner to close vulnerabilities. An AI scanner that does not improve that number remains an expensive decoration.

Attribution without surveillance

  1. Identity settings in Copilot telemetry address two management tasks.

  2. The first is cost allocation: an executive can see which team and developer consume models without anyone reading their prompts.

  3. The second use is incident investigation: if a key leaked from one machine, host.name narrows the search to a device, potentially cutting investigation from days to hours.

  4. An administrator enables the option through managed settings; it is off by default.

How we address this in projects

  1. In AI-native development and integration projects, we remove provider keys from people and agents. Developers, n8n workflows and MCP servers call LLM & Security Gateway using an internal token.

  2. The gateway stores Anthropic Claude, OpenAI, Google Gemini, Sber GigaChat and YandexGPT keys, sets team spending limits and controls outbound data.

  3. If an internal token leaks, it can be revoked centrally and the damage is bounded by the limit set beforehand.

  4. Around the gateway, we configure a standard pipeline: developer pre-commit checks, server-side repository checks, secrets in a vault, and MCP tokens passed through environment variables.

  5. The design looks simple, but making it work requires reviewing the team’s repositories, services and habits.

  6. Companies often postpone this work until the first incident.

Conclusion

GitHub made a sensible choice: default protection blocks a key before it enters history. Treat the news as a reminder. Before connecting LLMs to development, decide where keys live, who owns them and how much loss a leak may cause. Without an answer to the last question, whoever finds the key determines the amount.

Source

Discuss the article: A Claude key in Git: GitHub blocks…

Enter your email or phone number so we can get back to you.

Send via: