-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Improve Algolia detector context matching #4905
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,12 @@ var ( | |
| // Keywords are used for efficiently pre-filtering chunks. | ||
| // Use identifiers in the secret preferably, or the provider name. | ||
| func (s Scanner) Keywords() []string { | ||
| return []string{"metabase"} | ||
| return []string{ | ||
| "metabase", | ||
| "X-Metabase-Session", | ||
| "X-API-Key", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Overly generic "X-API-Key" keyword triggers false pre-filter matchesMedium Severity The keyword Reviewed by Cursor Bugbot for commit 33bc856. Configure here. |
||
| "METABASE_API_KEY", | ||
| } | ||
| } | ||
|
|
||
| // FromData will find and optionally verify Metabase secrets in a given set of bytes. | ||
|
|
||


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.
New keywords are redundant substrings of existing keyword
Low Severity
All four new keywords (
ALGOLIA_API_KEY,ALGOLIA_APPLICATION_ID,x-algolia-api-key,x-algolia-application-id) containalgoliaas a substring. The Aho-Corasick pre-filter inahocorasickcore.goalready lowercases both keywords and chunk data, and performs substring matching. Since"algolia"is already a keyword, it will match any text containing the new keywords, making them entirely redundant. They don't expand detection coverage but do add unnecessary entries to the trie and keyword-to-detector map.Reviewed by Cursor Bugbot for commit 7fd27bb. Configure here.