trufflehog
trufflehog copied to clipboard
Bannerbear Detector V2
Description:
This pull request introduces a new V2 detector for Bannerbear API keys. The new version adds support for modern key formats and implements live API verification to eliminate false positives.
Implementation Details
- New V2 Detector: A new
bannerbearv2detector was created to house the updated logic. - Precise Regex: The detector uses the pattern
\b(bb_(?:pr|ma)_[a-f0-9]{30})\bto accurately identify both key formats. - API Verification: A verification function calls the
GET /v2/authendpoint.- A
200 OKresponse validates a Project API Key. - A
400 Bad Requestwith a specific error message validates a Master API Key, in line with the official API documentation.
- A
- Keywords: Added
bannerbear,bb_pr_, andbb_ma_to the keyword list for efficient scanning.
Testing
To ensure correctness and reliability, this change includes:
- Pattern Tests: Tests validating the regex against positive and negative samples.
- Integration Tests: Live API tests confirming the verification logic for valid Project keys and invalid keys.
Closes OSS-143
Checklist:
- [x] Tests passing (
make test-community)? - [x] Lint passing (
make lintthis requires golangci-lint)?