Skip to content

fix(942200): reduce false positive - rollback regex#4525

Closed
touchweb-vincent wants to merge 8 commits into
coreruleset:mainfrom
touchweb-vincent:patch-16
Closed

fix(942200): reduce false positive - rollback regex#4525
touchweb-vincent wants to merge 8 commits into
coreruleset:mainfrom
touchweb-vincent:patch-16

Conversation

@touchweb-vincent

@touchweb-vincent touchweb-vincent commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Hello,

The new regex (6f855a4) cannot be accepted in its current state since it triggers on common Bot (GoogleBot / BingBot).

I suggest performing an urgent rollback and revisiting the adjustment afterward.

closes #4502

PR Checklist

  • I have read the CONTRIBUTING doc
  • I have added positive tests proving my fix/feature works as intended.
  • I have added negative tests that prove my fix/feature considers common cases that might end in false positives
  • In case you changed a regular expression, you are not adding a ReDOS for pcre. You can check this using regexploit
  • My test use the comment field to write the expected behavior
  • I have added documentation for the rule or change (when appropriate)

Further comments

For the reviewer

  • Positive and negative tests were added
  • Tests cover the intended fix/feature properly
  • No usage of dangerous constructs like ctl:requestBodyAccess=Off were used in the rule
  • In case a regular expression was changed, there is no ReDOS
  • Documentation is clear for the rule/change

Added new test cases for BingBot and GoogleBot user agents to validate against CRS 4.24.0 update.
@touchweb-vincent touchweb-vincent changed the title fix(942200): reduce false positive - revert regex fix(942200): reduce false positive - rollback regex Mar 5, 2026
@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

📊 Quantitative test results for language: eng, year: 2023, size: 10K, paranoia level: 1:
🚀 Quantitative testing did not detect new false positives

Removed test case for false positive on French addresses and adjusted test IDs.
Removed multiple SQL injection test cases from 942200.yaml.
@Barnoux

Barnoux commented Mar 7, 2026

Copy link
Copy Markdown

For information, the rule is also triggered on brave browser (version 1.86.139) which have this User-agent:
Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Mobile Safari/537.36

image

@EsadCetiner EsadCetiner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't be approving this since I'm not an SQL expert, but I can see that you've rewritten multiple tests completely. Don't rewrite existing tests, if behavior has changed then instead change the expected output to reflect the changes in this PR and document known False Positives and False Negatives in the test description.

@touchweb-vincent

Copy link
Copy Markdown
Contributor Author

@EsadCetiner I'm not rewriting anything, i'm reverting this PR : 6f855a4 - that's all. We can discuss it later in a separate PR with new unit tests.

@EsadCetiner

Copy link
Copy Markdown
Member

@touchweb-vincent I know your reverting that PR, but that doesn't mean you should remove those tests. This rule has very few tests written for it, and is part of the reason why this false positive was missed.

@touchweb-vincent

Copy link
Copy Markdown
Contributor Author

In my humble opinion, we should roll back, urgently release a 4.24.1, and revisit this discussion afterwards.

@EsadCetiner

Copy link
Copy Markdown
Member

@touchweb-vincent This isn't a discussion, you should never delete tests, they exist to prevent regressions and bugs. Please add them back, adjust as needed then add your new tests on top of that.

Updated test cases to reflect changes in SQL injection detection scenarios, including modifying User-Agent headers, request methods, and expected outputs.
@touchweb-vincent

Copy link
Copy Markdown
Contributor Author

I have added back the unit tests from 6f855a4 so the regex is failing now.

theseion added a commit to theseion/coreruleset that referenced this pull request Mar 8, 2026
@EsadCetiner

Copy link
Copy Markdown
Member

@touchweb-vincent Tests 4, 5, 6, and 7 never passed before 6f855a4 was merged, adjust the expected output of those tests and update the test description to document that they are known false positives/false negatives

github-merge-queue Bot pushed a commit that referenced this pull request Mar 9, 2026
* fix(942200): prevent matches against user agent strings

Make matching of parenthesis more restrictive

Refs #4476
Fixes #4502
Closes #4525

* Apply suggestions from code review

* Apply suggestion from @fzipi

---------

Co-authored-by: Felipe Zipitría <[email protected]>
@fzipi fzipi closed this in #4537 Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive for rule 942200 by Googlebot after upgrading to v4.24.0

3 participants