Repository navigation
Detect Mapbox secret tokens without flagging public tokens - #86
Merged
Merged
Conversation
AI-assisted implementation and validation with OpenAI Codex.
omerbek
approved these changes
Dec 1, 2026
omerbek
left a comment
Owner
There was a problem hiding this comment.
Verified locally on Windows (CPython 3.11) before merging:
- Both new tests fail on
main(AssertionError: 0 != 1) and pass with the pattern — red before green. - Full suite: 119 tests on
main, 121 on this branch, with the same single pre-existing Windows-only error (OSError: [Errno 22]for theodd name .jsfixture — a filename Windows cannot create). Nothing new fails. python repodx.py .→ 100/100 (A), 0 findings.- Adversarial checks on the pattern:
sk.<payload>.<sig>is reported (including inside an?access_token=URL);pk.is not;ask./tsk.do not match, so the�holds; a bareeyJ…JWT does not match; and a too-shortsk.eyJabc.defdoes not match, so the{20,}floors hold.
Matches #69 exactly, one line of detection plus two tests, no assertions weakened. Thanks for the clear writeup and for claiming the issue first.
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 #69.
Add the Mapbox secret-token pattern to
SECRET_PATTERNS. Mapbox documents a literalsk/pkheader, a base64url JSON payload, and a signature: https://docs.mapbox.com/api/accounts/tokens/#token-format. Onlyskmatches; browser-safepktokens remain unreported.The existing
eyJcandidate literal already reaches this detector. Runtime-generated fake-token tests cover the full file-scanning path, exactly one secret finding (no JWT/Supabase duplicate), and no finding for the corresponding public token. No real credentials or provider requests are used.Validation:
python3 -m unittest discover: 121 tests pass.python3 repodx.py .: 100/100, zero findings (Linux and Windows).A Windows full-suite attempt hit six existing temporary-Git initialization failures; the complete Linux suite passes. No assertions or checks were weakened.
AI assistance: implemented and validated with OpenAI Codex. Claimed in #69 before implementation.