feat: reject digit-adjacent tokens and raise default threshold to 8 - #16
Merged
Conversation
Tokens like board[0] or abandon123 where the stripped non-alpha portion contains digits are now disqualified (return null) instead of matching as BIP39 words. This prevents false positives from array indexing and variable naming in code. Also raises DEFAULT_THRESHOLD from 5 to 8 via a shared constant exported from detect.ts, reducing false positives from prose that happens to contain common BIP39 words.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
added 2 commits
February 7, 2026 15:52
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.
Summary
stripToken— Tokens where the stripped leading/trailing portion contains digits (e.g.board[0],abandon123,3abandon) are now disqualified as sequence-breaking (null), preventing false positives from array indexing and code constructs. Applied to TypeScript and both Bash scripts.DEFAULT_THRESHOLDfromdetect.tsand shared acrosscheck-staged.tsandscan-repo.ts. Reduces false positives from prose containing common BIP39 words while still catching 12/24/25-word mnemonics.BIP39_THRESHOLD=12as the override illustration.Test plan
pnpm vitest run)board[0]..board[8]code snippet (no false positive)DEFAULT_THRESHOLDconstant verified in detect.ts, check-staged.ts, scan-repo.ts