Metabase: match only UUID session tokens (reduce false positives)#4998
Open
ArisRhiannon wants to merge 1 commit into
Open
Metabase: match only UUID session tokens (reduce false positives)#4998ArisRhiannon wants to merge 1 commit into
ArisRhiannon wants to merge 1 commit into
Conversation
The detector matched any 36-char [a-zA-Z0-9-] string near the "metabase" keyword, so URL slugs and descriptive strings were flagged as session tokens. Metabase session tokens (X-Metabase-Session) are UUIDs (generate-session-key returns (str (random-uuid))), so tighten keyPat to the UUID format. Added a regression test. Fixes trufflesecurity#4633
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 #4633
Description
The Metabase detector matches any 36-character
[a-zA-Z0-9-]string near themetabasekeyword, so URL slugs and other descriptive strings get flagged as session tokens (the case reported in #4633).Metabase session tokens (
X-Metabase-Session) are UUIDs:src/metabase/session/models/session.clj—generate-session-keyreturns(str (random-uuid))POST /api/sessionreturns{"id": "<uuid>"}This tightens
keyPatto the UUID format, which removes the false positives at the source without extra heuristics. Detection of real tokens is unchanged.Tests
Added a regression case (a 36-char URL slug is no longer flagged).
go test ./pkg/detectors/metabase/andgo vetpass.Note
@rootranjan already opened #4634 for this same issue using a slug/word-filtering approach — thanks for that work. This is a smaller, root-cause alternative (a one-line regex change) in case it's helpful; happy to defer to #4634 or close this if you'd prefer that direction.
Note
Low Risk
Scoped regex and test updates in the Metabase detector only; no auth or verification flow changes beyond stricter matching.
Overview
Tightens the Metabase session-token detector so it only matches UUID-shaped
X-Metabase-Sessionvalues instead of any 36-character alphanumeric string near themetabasekeyword. That stops URL slugs and similar descriptive strings (e.g.prod-analytics-dashboard-public-link) from being reported as secrets while keeping real tokens detectable.Tests now use a UUID example and add a regression case asserting those slugs are not flagged.
Reviewed by Cursor Bugbot for commit 9342bab. Bugbot is set up for automated code reviews on this repo. Configure here.