Skip to content

feat(dlp): detect Replicate, Perplexity and xAI API keys - #489

Closed
bewfordq wants to merge 1 commit into
blitzcrieg1:masterfrom
bewfordq:fix/dlp-replicate-perplexity-xai
Closed

bewfordq wants to merge 1 commit into
blitzcrieg1:masterfrom
bewfordq:fix/dlp-replicate-perplexity-xai

Conversation

@bewfordq

Copy link
Copy Markdown
Contributor

Refs #454.

Three more providers whose key formats no existing rule matches:

  • Replicate tokens are r8_ prefixed.
  • Perplexity keys are pplx- prefixed.
  • xAI keys are xai- prefixed.

None of them start with sk-, so generic_provider_api_key and the Anthropic/DashScope rules never see
them - a leaked key of any of these three produces no DLP finding today.

Change

Verification

pytest is not available in this environment, so the manifest was loaded and each pattern compiled directly:
all three rules are present, each matches a realistic sample, and each rejects a short lookalike.

@bewfordq
bewfordq force-pushed the fix/dlp-replicate-perplexity-xai branch from 87e2540 to c207e00 Compare November 26, 2026 00:01

@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 building these out. The GitHub checks are green. Could you tighten the formats before merge?

  • Replicate documents 40 characters total. The current pattern can accept shorter values or match only a prefix when a suffix contains an underscore or hyphen. Please check the supported alphabet and test the complete match, token boundaries, and a one-character-short input. Replicate token documentation · TruffleHog detector
  • For Perplexity and xAI, please cite the key shapes you intend to support and test complete matches and realistic near-misses.
  • Please add synthetic tests on both the hook and orchestrator scrubbers showing that capture removes the entire value. This branch and #488 both change the test count, so the branch that lands second will need a fresh collection and CI on the updated base.

@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