[INS-406] Braintrust detector#4826
Open
MuneebUllahKhan222 wants to merge 2 commits intotrufflesecurity:mainfrom
Open
[INS-406] Braintrust detector#4826MuneebUllahKhan222 wants to merge 2 commits intotrufflesecurity:mainfrom
MuneebUllahKhan222 wants to merge 2 commits intotrufflesecurity:mainfrom
Conversation
|
|
||
| type Scanner struct { | ||
| client *http.Client | ||
| detectors.DefaultMultiPartCredentialProvider |
Contributor
There was a problem hiding this comment.
This detector has a single credential
Comment on lines
+131
to
+133
| func (s Scanner) Description() string { | ||
| return "Braintrust is an AI evaluation and observability platform. This detector identifies Braintrust API keys." | ||
| } |
Contributor
There was a problem hiding this comment.
The Description() text is surfaced to customers in the enterprise UI, so mentioning "This detector identifies..." can be a bit confusing in that context. The pattern we follow is:
- First sentence: What the service/platform is.
- Second sentence: What risk the exposed credential poses.
Something like: "Braintrust is an AI evaluation and observability platform. Braintrust API keys can be used to access and manage projects, experiments, and evaluation data."
(Feel free to adjust the second sentence based on what the key actually grants access 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 Braintrust API Key Detector for TruffleHog.
It scans for Braintrust API keys (prefix
sk-) and optionally verifies them via the official API.Regex:
\b(sk-[A-Za-z0-9]{48})\bVerification
For verification, we use the Braintrust Projects API: https://api.braintrust.dev/v1/project?limit=1. We send a GET request with the token in the Authorization: Bearer header. A response code of 200 OK means the token is valid. 401 Unauthorized means it is an invalid or revoked token, while 403 Forbidden indicates a valid token with insufficient permissions.
This API endpoint is part of the official Braintrust API and can be used safely for verification. It is read-only and does not perform any destructive actions.
Corpora Test
The detector does not appear in the list.

Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Adds a new detector that performs outbound HTTP verification calls to Braintrust’s API and extends the shared detector-type enum, which could impact scan behavior and downstream consumers if the new verification semantics or enum value are mishandled.
Overview
Adds a new
braintrustdetector that identifiessk--prefixed Braintrust API keys via regex, deduplicates matches, and redacts findings.Introduces optional online verification by calling Braintrust’s
GET /v1/project?limit=1with a bearer token and treating200/403as valid and401as invalid, plus new unit/integration tests and a benchmark covering match and verification error scenarios.Registers the detector in the default detector set and adds a new protobuf enum value
DetectorType_BrainTrustApiKeyso results can be categorized consistently.Written by Cursor Bugbot for commit aa7eec3. This will update automatically on new commits. Configure here.