fix(dropbox): prevent long sl.u. tokens from being truncated#5012
Open
lukem-ts wants to merge 1 commit into
Open
fix(dropbox): prevent long sl.u. tokens from being truncated#5012lukem-ts wants to merge 1 commit into
lukem-ts wants to merge 1 commit into
Conversation
…erification Newer scoped Dropbox short-lived tokens (sl.u.…) can be ~1.5KB. The scanning engine only passes a keyword-centered window of the chunk (512 bytes by default) to FromData, so these tokens were truncated before the regex saw them, producing an invalid token that always verified as false. Implement detectors.MaxSecretSizeProvider on the Dropbox scanner so the engine widens its window to fit the full token. Add a regression test that drives a long token through the Aho-Corasick windowing path. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
Corpora Test ResultsNo detector regex or keyword changes in this PR. Bench skipped. |
amanfcp
approved these changes
Jun 3, 2026
mariduv
approved these changes
Jun 3, 2026
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.
Newer scoped Dropbox short-lived tokens (sl.u.…) can be ~1.5KB. The scanning engine only passes a keyword-centered window of the chunk (512 bytes by default) to FromData, so these tokens were truncated before the regex saw them, producing an invalid token that always verified as false.
Implement detectors.MaxSecretSizeProvider on the Dropbox scanner so the engine widens its window to fit the full token. Add a regression test that drives a long token through the Aho-Corasick windowing path.
Description:
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Localized detector and test changes; no auth, data handling, or engine-wide behavior beyond the Dropbox scanner’s secret window size.
Overview
Fixes false negatives for long scoped Dropbox tokens (
sl.u.…, ~1.5KB) by implementingdetectors.MaxSecretSizeProvideron the Dropbox scanner withMaxSecretSize()→ 4096, so the engine widens the keyword-centered chunk window beyond the default 512 bytes beforeFromDataruns the regex.Adds
TestDropBox_LongTokenThroughEngineWindow, which drives a ~1505-character token through the Aho-Corasick match/window path to guard against regressions on that windowing behavior.Reviewed by Cursor Bugbot for commit 664f470. Bugbot is set up for automated code reviews on this repo. Configure here.