Add support for detecting and validating CastAI API tokens#4926
Open
patrickpichler wants to merge 1 commit intotrufflesecurity:mainfrom
Open
Add support for detecting and validating CastAI API tokens#4926patrickpichler wants to merge 1 commit intotrufflesecurity:mainfrom
patrickpichler wants to merge 1 commit intotrufflesecurity:mainfrom
Conversation
80ee9e0 to
e828423
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit e828423. Configure here.
| maps.Copy(s1.ExtraData, extraData) | ||
| s1.SetVerificationError(verificationErr, match) | ||
| break | ||
| } |
There was a problem hiding this comment.
Verification breaks on first endpoint error, skipping alternatives
Medium Severity
When the first endpoint returns a transient error (timeout, 5xx), the loop breaks immediately without trying the remaining endpoint. A token valid on the EU endpoint would be reported as unverified with an error if the US endpoint happens to be temporarily unreachable, since the continue only fires for definitive 401 responses (!isVerified && verificationErr == nil).
Reviewed by Cursor Bugbot for commit e828423. Configure here.
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.


Fixes #4925
Description:
This PR adds a custom detector for CastAI API keys.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Medium Risk
Adds a new network-verifying detector and a new
DetectorTypeenum value, which can affect default scanning behavior and downstream consumers of detector type IDs. Risk is limited to detector plumbing plus an internal refactor usingmaps.Copyfor AWS extra data merging.Overview
Adds a new
castaidetector that findscastai_v1_...API tokens, optionally verifies them viaX-API-Keycalls against the US/EU CastAI endpoints, and reports the verifying endpoint inExtraData.Wires the detector into the default detector set and introduces the new
DetectorType_CastAI(CastAI = 1048) in protobuf-generated enums. Includes unit, integration, and benchmark coverage for matching and verification error handling.Also refactors AWS access key verification result merging to use
maps.Copyinstead of a manual map loop.Reviewed by Cursor Bugbot for commit e828423. Bugbot is set up for automated code reviews on this repo. Configure here.