-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bannerbear Detector V2 #4222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bannerbear Detector V2 #4222
Conversation
c87f902
to
fdaaacc
Compare
fdaaacc
to
b8285a3
Compare
|
||
// docs: https://developers.bannerbear.com/ | ||
func (s Scanner) verifyBannerBear(ctx context.Context, client *http.Client, key string) (bool, map[string]string, error) { | ||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, "https://api.bannerbear.com/v2/auth", http.NoBody) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using same API to verify V1 and V2 secret types. Why are we not using same function in both versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kashifkhan0771 The V2 verification function includes specific logic to differentiate between Project and Master API keys. Since this additional processing is not required for V1 keys (although we could still use the same function, which would make things complex), I decided against merging them to keep the V1 verifier clean and straightforward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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
bannerbearv2
detector was created to house the updated logic.\b(bb_(?:pr|ma)_[a-f0-9]{30})\b
to accurately identify both key formats.GET /v2/auth
endpoint.200 OK
response validates a Project API Key.400 Bad Request
with a specific error message validates a Master API Key, in line with the official API documentation.bannerbear
,bb_pr_
, andbb_ma_
to the keyword list for efficient scanning.Testing
To ensure correctness and reliability, this change includes:
Closes
OSS-143
Checklist:
make test-community
)?make lint
this requires golangci-lint)?