You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security/leaked-secrets: keyword prefilter, bounded look-behind and near-miss cases in the test suite #363
Three test-suite habits from trufflehog's detector tests, to land with or before the pattern work:
Prefilter assertion: once a keyword prefilter (Aho-Corasick or a single alternation) gates which patterns run, every positive case in the corpus harness must also assert that the prefilter selects that pattern for the input. A pattern whose keyword is not in its own positives is a test failure.
Bounded look-behind for CONTEXT patterns: replace the ±500-char window with keyword → at most 40 chars → word-bounded value, matching trufflehog's PrefixRegex helper. Assert both directions: keyword 30 chars before the value fires, keyword 60 chars before does not, keyword after the value does not.
Near-miss negatives: for every pattern, one case with a single corrupted character, one with the prefix mid-token (fooghp_…), and one duplicate value that must collapse to one finding. Generated mechanically from the generator, not hand-written.
Acceptance Criteria
A meta-test fails if any pattern in FAST_PATTERNS or CONTEXT_PATTERNS lacks a positive, a near-miss negative and a prefilter assertion in the corpus
CONTEXT patterns use a bounded look-behind; the three-direction assertions pass for every context pattern
expected.json snapshot updated and the README gap list shrinks accordingly
Activity
fix(rules): leaked-secrets precision and test habits (#357, #363) (#366)