fix(932330): require non-alphanumeric prefix for bash negation pattern#4595
fix(932330): require non-alphanumeric prefix for bash negation pattern#4595zoutjebot wants to merge 5 commits into
Conversation
|
📊 Quantitative test results for language: |
|
Can you add tests? Positive and negative, so we cover both cases. Thanks! |
ReviewApproach is reasonable — adding a boundary prefix to reduce FPs on product codes. A few issues:
|
|
Thanks for the detailed review @fzipi! I've addressed all points:
|
|
Thanks for the detailed review @fzipi! I've addressed all points:
|
The pattern !-\d (bash file test negation like !-f, !-d) matches too broadly when it can appear anywhere in a value. Strings like 'abc!-1' or product codes containing '!-' followed by digits trigger false positives. Adding (?:^|[^a-zA-Z0-9]) ensures the pattern only matches at the start of input or after a non-alphanumeric character, consistent with how bash negation operators actually appear in shell commands. Refs: coreruleset#4584
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Tests 4 and 5 used !-f and !-d but rule 932330 matches !-\d (digits only). Changed to !-5 and !-7 so the tests match what the rule actually detects.
230df2e to
ecb3655
Compare
|
Fixed the failing regression tests. Tests 4 and 5 used Quick summary of current state:
|
What
Add
(?:^|[^a-zA-Z0-9])before!-\\dto prevent FPs on product codes and values containing '!-' followed by digits.Context
Part of CVE-derived payload research FP reductions. See tracking issue #4584 for full context.
Refs: #4584