feat(detectors): add Cerebras API key detector#5129
Open
PhinehasNarh wants to merge 2 commits into
Open
Conversation
Cerebras hosts a paid AI inference API, so its keys fit the sourcing guidelines. Keys have the form `csk-` followed by 48 lowercase alphanumeric characters and authenticate via `Authorization: Bearer`. Verification uses the OpenAI-compatible, non-destructive `GET https://api.cerebras.ai/v1/models` endpoint: 200 -> verified, 401 -> determinately unverified, anything else -> indeterminate. - proto/detector_type.proto: add `Cerebras = 1063` (regenerated pb.go) - pkg/detectors/cerebras: detector + pattern test + integration test (modeled on the existing groq detector, same verification shape) - pkg/engine/defaults/defaults.go: register the detector
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 89c8ca9. Configure here.
The detector populates SecretParts on every Result, so the integration test's cmpopts.IgnoreFields must ignore it too (matching the anthropic detector), otherwise cmp.Diff against the want structs fails.
Author
|
Good catch by Bugbot - fixed in 51cfce4. The detector sets |
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:
Adds a new secret detector for Cerebras Inference API keys.
Cerebras runs a paid, hosted AI-inference API, so its keys fit the sourcing guidelines (paid service). Keys have the form
csk-followed by 48 lowercase-alphanumeric characters and are sent asAuthorization: Bearer <key>.Verification uses the OpenAI-compatible, non-destructive
GET https://api.cerebras.ai/v1/modelsendpoint:200 OK401 UnauthorizedThis mirrors the existing
groqdetector, which uses the same OpenAI-compatible verification shape.Changes
proto/detector_type.proto: addCerebras = 1063; regeneratedpkg/pb/detector_typepb/detector_type.pb.go.pkg/detectors/cerebras/: detector + pattern test + integration test.pkg/engine/defaults/defaults.go: register the detector in the default set.The integration test reads
CEREBRAS/CEREBRAS_INACTIVEfrom thedetectors5GSM bucket (matching the convention used by other detectors).Checklist:
go test ./pkg/detectors/cerebras/...passes;go build ./pkg/engine/defaults/...,gofmt, andgo vetare clean. (Couldn't run the fullmake test-community/make lintlocally, but the detector is structurally identical to the mergedgroqdetector.)make lint)?Note
Low Risk
Additive detector-only change following established patterns; verification is a read-only models list call with no changes to core scan or auth paths.
Overview
Adds Cerebras Inference API key detection and optional live verification to TruffleHog.
New
pkg/detectors/cerebrasmatchescsk-plus 48 lowercase alphanumeric characters (keywordcsk-), deduplicates hits, and when verification is on callsGET https://api.cerebras.ai/v1/modelswithAuthorization: Bearer—200 marks verified, 401 unverified, other statuses surface a verification error (same OpenAI-style shape asgroq).DetectorType_Cerebras(1063) is added inproto/detector_type.protowith regenerated protobufs, and&cerebras.Scanner{}is wired into the default detector list. Pattern, integration (GCPdetectors5secrets), and benchmark tests ship with the detector.Reviewed by Cursor Bugbot for commit 51cfce4. Bugbot is set up for automated code reviews on this repo. Configure here.