Skip to content

feat(dlp): detect OpenRouter and Groq API keys - #488

Closed
bewfordq wants to merge 2 commits into
blitzcrieg1:masterfrom
bewfordq:fix/dlp-openrouter-groq
Closed

bewfordq wants to merge 2 commits into
blitzcrieg1:masterfrom
bewfordq:fix/dlp-openrouter-groq

Conversation

@bewfordq

Copy link
Copy Markdown
Contributor

Refs #454.

Same bug class as #478/#483: two more providers whose keys no rule matches.

  • OpenRouter keys look like sk-or-v1-<hex>. The hyphen after sk breaks generic_provider_api_key's
    alphanumeric run at the fifth character, so a leaked OpenRouter key produces no finding.
  • Groq keys start gsk_, which the sk- rules never match at all (the g breaks the word boundary).

Change

Verification

pytest is not installed in this environment, so the manifest was loaded and the patterns compiled directly:
both new rules match their sample keys, both reject short lookalikes, and the legacy sk- rule does not
match the OpenRouter sample - which is the gap being closed.

bew and others added 2 commits November 25, 2026 23:19
Same bug class as blitzcrieg1#483: OpenRouter keys (sk-or-v1-...) break the generic
sk-[a-zA-Z0-9]{20,} rule's alnum-only run at the hyphen after "sk", and Groq
keys (gsk_...) don't match any existing prefix at all. Both leaked silently
with zero findings. Adds dedicated rules for each, next to the other
provider-specific sk- exceptions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@blitzcrieg1 blitzcrieg1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding coverage for these two providers. The GitHub checks are green. Before merge, could you tighten the token matching and add capture-scrubbing tests?

  • The OpenRouter pattern accepts truncated suffixes and letters outside hex. TruffleHog documents a 64-hex suffix in its detector. Please match the supported format with a full-token boundary and add truncated and non-hex near-misses. TruffleHog detector
  • For Groq, please cite the key shapes this rule intends to support and test a realistic near-miss. The current minimum length by itself leaves the rule broad.
  • These formats are missing from the separate hook and orchestrator scrubbers. Please add synthetic coverage showing that both paths remove the entire value when argument or command capture is enabled.

@blitzcrieg1

Copy link
Copy Markdown
Owner

Landed combined with #489 as PR #495 (both touched the same manifest region and conflicted with master; README recounted to 3004, CHANGELOG entry added). Thanks @bewfordq.

blitzcrieg1 added a commit that referenced this pull request Nov 26, 2026
…mbined #488 #489) (#495)

* feat(dlp): detect OpenRouter and Groq API keys

Same bug class as #483: OpenRouter keys (sk-or-v1-...) break the generic
sk-[a-zA-Z0-9]{20,} rule's alnum-only run at the hyphen after "sk", and Groq
keys (gsk_...) don't match any existing prefix at all. Both leaked silently
with zero findings. Adds dedicated rules for each, next to the other
provider-specific sk- exceptions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat(dlp): detect Replicate, Perplexity and xAI API keys

* docs: changelog entry for the five provider key DLP rules (#488, #489)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>

---------

Co-authored-by: bewfordq <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: Mistral Vibe <[email protected]>
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.

3 participants