Skip to content

feat: add Anthropic API key detection#1910

Merged
zricethezav merged 1 commit into
gitleaks:masterfrom
mhlakhani:add-anthropic-api-key-detection
Jul 15, 2025
Merged

feat: add Anthropic API key detection#1910
zricethezav merged 1 commit into
gitleaks:masterfrom
mhlakhani:add-anthropic-api-key-detection

Conversation

@mhlakhani
Copy link
Copy Markdown
Contributor

Description:

Add detection rules for Anthropic API keys:

  • anthropic-api-key: detects sk-ant-api03-... keys
  • anthropic-admin-api-key: detects sk-ant-admin01-... keys

Both key types follow the pattern sk-ant-{type}-{93 chars}AA and are detected as separate rules to align with gitleaks patterns for multi-token providers.

The base regex patterns are aligned with what TruffleHog uses here: https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/anthropic/anthropic.go

Checklist:

  • Does your PR pass tests?
  • Have you written new tests for your changes?
  • Have you lint your code locally prior to submission?

Add detection rules for Anthropic API keys:
- anthropic-api-key: detects sk-ant-api03-... keys
- anthropic-admin-api-key: detects sk-ant-admin01-... keys

Both key types follow the pattern sk-ant-{type}-{93 chars}AA
and are detected as separate rules to align with gitleaks
patterns for multi-token providers.

The base regex patterns are aligned with what TruffleHog uses here: https://github.com/trufflesecurity/trufflehog/blob/main/pkg/detectors/anthropic/anthropic.go
@zricethezav zricethezav merged commit 72977e4 into gitleaks:master Jul 15, 2025
2 checks passed
@zricethezav
Copy link
Copy Markdown
Collaborator

🙇🏻 ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants