[INS-197] Add redhatpyxis api key detector#4995
Open
MuneebUllahKhan222 wants to merge 2 commits into
Open
Conversation
Corpora Test ResultsScans a corpus of real-world public code against only the detectors changed in this PR, then compares unique match counts between the PR build and the main baseline to catch regex regressions. Verification is disabled — each detector's regex is measured independently. 1 new · 0 clean | Scoped to:
|
| // Keywords used for fast pre-filtering | ||
| func (s Scanner) Keywords() []string { | ||
| return []string{ | ||
| "redhat", |
Contributor
There was a problem hiding this comment.
Do you think it'll be beneficial to add pyxis to the detector/regex keywords instead of redhat or along with redhat?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the Red Hat Pyxis API Key Detector for TruffleHog.
It scans for Red Hat Pyxis API keys and optionally verifies them via the official Red Hat Ecosystem Catalog API.
Regex:
The detector uses contextual keyword
redhatto reduce false positives.Verification
For verification, we use the Red Hat Pyxis Projects API:
We send a
GETrequest with the token in theX-API-KEYheader.A response code of:
200 OKmeans the API key is valid401 Unauthorizedmeans the API key is invalid.This API endpoint is part of the official Red Hat Ecosystem Catalog API and can be used safely for verification. It is a read-only endpoint and does not perform any destructive actions.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Additive detector and enum wiring; verification uses a read-only external API and is gated by an existing feature-flag pattern.
Overview
Adds a Red Hat Pyxis secret detector that finds 32-character lowercase alphanumeric API keys near a
redhatkeyword and, when verification is on, checks them with a read-onlyGETto the Red Hat Ecosystem Catalog (X-API-KEY), treating 200 as valid and 401 as invalid.Wires the scanner into the default engine list behind
RedHatPyxisDetectorEnabled(enabled by default inmain.go, same pattern as Pinecone/Cloudinary), registersDetectorType_RedHatPyxis(1053) in proto/generated enums, and adds unit, pattern, integration, and benchmark tests.Reviewed by Cursor Bugbot for commit d6b0690. Bugbot is set up for automated code reviews on this repo. Configure here.