[INS-497] Add Pganalyze Read Key Detector#4993
Open
MuneebUllahKhan222 wants to merge 1 commit 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:
|
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 pganalyze Read API Key Detector for TruffleHog.
It scans for pganalyze Read API keys and optionally verifies them via the official pganalyze GraphQL API.
Regex:
The detector uses the contextual keyword
pgar_to reduce false positives.Verification
For verification, we use the pganalyze GraphQL API endpoint:
We send a
POSTrequest with the token in theAuthorizationheader using the format: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 pganalyze API surface and can be used safely for verification. The verification request performs a read-only GraphQL query and does not perform any destructive actions.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Standard additive secret detector with feature-flag rollout; verification only calls pganalyze’s GraphQL endpoint with read keys and does not change auth or core scan paths.
Overview
Adds a pganalyze Read API key detector that finds tokens matching
pgar_plus 27 alphanumeric characters (keyword prefilterpgar_), tags results as read-only access, and optionally verifies them with aPOSTtohttps://app.pganalyze.com/graphqlusingAuthorization: Token <key>(200 → verified, 401 → invalid).Wires the scanner into the default engine list, introduces protobuf type
PgAnalyzeReadKey(1053), and rolls it out behindPgAnalyzeReadKeyDetectorEnabled(enabled by default in OSSmain.go, same gating pattern as Pinecone/Cloudinary). Includes unit, pattern, integration, and benchmark tests.Reviewed by Cursor Bugbot for commit 15b8997. Bugbot is set up for automated code reviews on this repo. Configure here.