Reduce false positives in Metabase detector #4634
Open
+123
−5
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 #4633
Description:
Reduce false positives in Metabase detector by filtering out URL slugs and descriptive strings that match the detector pattern but are not actual session tokens.
Changes:
res.Body.Close()errorsThis reduces false positives from URL slugs and descriptive identifiers while still detecting real Metabase session tokens that are random alphanumeric strings.
Problem:
The Metabase detector was flagging any 36-character alphanumeric string (including hyphens) near the keyword "metabase" and a URL as a potential session token, including:
-journal-deduplication-id-to-voucherfromquestion/12345-journal-deduplication-id-to-voucher)Solution:
Added
isLikelyFalsePositive()helper function with multiple filters:http://,https://,/question/, path separators)Implementation Details:
FromData()to useFindAllStringSubmatchIndex()to get match positions for context extractionhttp://,/question/, descriptive words)Checklist:
make test-community)?make lintthis requires golangci-lint)?