fix 941170#2292
Merged
Merged
Conversation
theMiddleBlue
force-pushed
the
fix-941170-rx
branch
from
November 7, 2021 15:51
20f87e3 to
de17e77
Compare
theMiddleBlue
force-pushed
the
fix-941170-rx
branch
from
November 8, 2021 10:02
de17e77 to
a06898a
Compare
theseion
reviewed
Nov 11, 2021
| # [NoScript InjectionChecker] Attributes injection | ||
| # | ||
| SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:\W|^)(?:javascript:(?:[\s\S]+[=\\\(\[\.<]|[\s\S]*?(?:\bname\b|[\\\\][ux]\d))|data:(?:(?:[a-z]\w+/\w[\w+-]+\w)?[;,]|[\s\S]*?;[\s\S]*?\b(?:base64|charset=)|[\s\S]*?,[\s\S]*?<[\s\S]*?\w[\s\S]*?>))|@\W*?i\W*?m\W*?p\W*?o\W*?r\W*?t\W*?(?:/\*[\s\S]*?)?(?:[\"']|\W*?u\W*?r\W*?l[\s\S]*?\()|\W*?-\W*?m\W*?o\W*?z\W*?-\W*?b\W*?i\W*?n\W*?d\W*?i\W*?n\W*?g[\s\S]*?:[\s\S]*?\W*?u\W*?r\W*?l[\s\S]*?\(" \ | ||
| SecRule REQUEST_COOKIES|!REQUEST_COOKIES:/__utm/|REQUEST_COOKIES_NAMES|REQUEST_HEADERS:User-Agent|REQUEST_HEADERS:Referer|ARGS_NAMES|ARGS|XML:/* "@rx (?i)(?:\W|^)(?:javascript:(?:[\s\S]+[=\\\(\[\.<]|[\s\S]*?(?:\bname\b|[\\\\][ux]\d))|data:(?:(?:[a-z]\w+/\w[\w+-]+\w)?[;,]|[\s\S]*?;[\s\S]*?\b(?:base64|charset=)|[\s\S]*?,[\s\S]*?<[\s\S]*?\w[\s\S]*?>))|@\W*?i\W*?m\W*?p\W*?o\W*?r\W*?t\W*?(?:/\*[\s\S]*?)?(?:[\"']|\W*?u\W*?r\W*?l[\s\S]*?\()|[^-]*?-\W*?m\W*?o\W*?z\W*?-\W*?b\W*?i\W*?n\W*?d\W*?i\W*?n\W*?g[^:]*?:\W*?u\W*?r\W*?l[\s\S]*?\(" \ |
Contributor
There was a problem hiding this comment.
For reference; [\s\S] matches any character including new lines (which . does not include).
The first replacement is equivalent, except that it does not match -.
Similar for the second one.
However, the removal of [\s\S]*? means that : can now only be followed by \W or u. This more or less excludes all characters and digits but still matches white space and new lines. If that is intentional, then the change looks good to me (the expression is more restrictive than before, which is usually ok).
fzipi
added a commit
that referenced
this pull request
Jun 2, 2026
replace [\s\S] with . in the .ra so crs-toolchain can generate a
PCRE-compatible pattern; [\s\S] expanded to [\x00-\x{10ffff}], which
fails toolchain validation and PCRE 8-bit compilation. . is
dotall-equivalent under modsec2-apache and modsec3-nginx (verified:
. matches newlines in both engines).
also revert the moz-binding branch quantifier [^-]*?- back to \W*?-,
the PCRE backtracking regression introduced in #2292 (see #4633), and
add test 6 covering the moz-binding branch, which had no coverage.
fzipi
added a commit
that referenced
this pull request
Jun 2, 2026
replace [\s\S] with . in the .ra so crs-toolchain can generate a
PCRE-compatible pattern; [\s\S] expanded to [\x00-\x{10ffff}], which
fails toolchain validation and PCRE 8-bit compilation. . is
dotall-equivalent under modsec2-apache and modsec3-nginx (verified:
. matches newlines in both engines).
also revert the moz-binding branch quantifier [^-]*?- back to \W*?-,
the PCRE backtracking regression introduced in #2292 (see #4633), and
add test 6 covering the moz-binding branch, which had no coverage.
Xhoenix
pushed a commit
to Xhoenix/coreruleset
that referenced
this pull request
Jun 4, 2026
* refactor: create 941170 `.ra` file
* refactor: decompose 941170 `.ra` into sub-assemblies
* fix(941170): use . over [\s\S] and fix moz-binding perf regression
replace [\s\S] with . in the .ra so crs-toolchain can generate a
PCRE-compatible pattern; [\s\S] expanded to [\x00-\x{10ffff}], which
fails toolchain validation and PCRE 8-bit compilation. . is
dotall-equivalent under modsec2-apache and modsec3-nginx (verified:
. matches newlines in both engines).
also revert the moz-binding branch quantifier [^-]*?- back to \W*?-,
the PCRE backtracking regression introduced in coreruleset#2292 (see coreruleset#4633), and
add test 6 covering the moz-binding branch, which had no coverage.
* Apply suggestions from code review
Co-authored-by: Max Leske <[email protected]>
* chore(formatting): auto fixes from pre-commit hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Max Leske <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.
No description provided.