Skip to content

feat(921200): move regexp to regex-assembly#4409

Merged
fzipi merged 7 commits into
mainfrom
regex-assemble/921200
Jan 29, 2026
Merged

feat(921200): move regexp to regex-assembly#4409
fzipi merged 7 commits into
mainfrom
regex-assemble/921200

Conversation

@fzipi
Copy link
Copy Markdown
Member

@fzipi fzipi commented Jan 18, 2026

what

  • move regex to regex-assembly format
  • add description and update documentation

why

  • enhancing readability

refs

Signed-off-by: Felipe Zipitria <felipe.zipitria@owasp.org>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 18, 2026

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request moves the LDAP injection detection regex (rule 921200) from inline format to regex-assembly format to enhance readability and maintainability. The PR also adds comprehensive test coverage with descriptive test names and organizes tests into negative (false positive) and positive (should trigger) categories.

Changes:

  • Created new regex-assembly file (921200.ra) with documented LDAP injection detection patterns
  • Updated the rule configuration to use the newly assembled regex
  • Enhanced test coverage from 10 to 30 test cases with descriptive names and better organization

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
regex-assembly/921200.ra New regex-assembly file with LDAP injection patterns, character class definitions, and comprehensive documentation of attack patterns
rules/REQUEST-921-PROTOCOL-ATTACK.conf Updated regex pattern for rule 921200 compiled from the regex-assembly file
tests/regression/tests/REQUEST-921-PROTOCOL-ATTACK/921200.yaml Expanded from 10 to 30 test cases, improved test descriptions, reorganized with clear negative/positive test sections

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rules/REQUEST-921-PROTOCOL-ATTACK.conf
Comment thread regex-assembly/921200.ra Outdated
Comment thread regex-assembly/921200.ra Outdated
Comment thread tests/regression/tests/REQUEST-921-PROTOCOL-ATTACK/921200.yaml Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 18, 2026

@fzipi I've opened a new pull request, #4411, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits January 19, 2026 19:34
…r class definitions (#4411)

* Initial plan

* fix(921200): use separate character class definitions to preserve original regex semantics

- Created ldap-prefix-chars definition (excludes : but NOT comma)
- Created ldap-pattern-chars definition (excludes comma and = but NOT colon)
- Updated prefix to use ldap-prefix-chars
- Updated pattern 1 to use ldap-pattern-chars
- Updated pattern 3 to use ldap-pattern-chars for first char class and ldap-prefix-chars for second char class
- Generated regex is identical to original, preserving matching behavior
- Validated with crs-toolchain regex compare and format

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

* docs(921200): improve clarity of character class documentation

- Reordered character class definitions to highlight differences (colon first vs comma first)
- Clarified that ldap-prefix-chars excludes colon and special chars but NOT comma
- Clarified that ldap-pattern-chars excludes comma and equals but NOT colon

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>
@fzipi fzipi requested a review from a team January 22, 2026 18:49
Copy link
Copy Markdown
Contributor

@franbuehler franbuehler left a comment

Choose a reason for hiding this comment

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

I found a small difference between the old and new regex. See comment.
But all attacks are detected with both regexes.
Tests look good too.

# * https://github.com/SpiderLabs/owasp-modsecurity-crs/issues/276#issue-126581660

SecRule REQUEST_COOKIES|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ^[^:\(\)\&\|\!<>\~]*\)\s*(?:\((?:[^,\(\)\=\&\|\!<>\~]+[><~]?=|\s*[&!|]\s*(?:\)|\()?\s*)|\)\s*\(\s*[\&\|\!]\s*|[&!|]\s*\([^\(\)\=\&\|\!<>\~]+[><~]?=[^:\(\)\&\|\!<>\~]*)" \
SecRule REQUEST_COOKIES|REQUEST_COOKIES_NAMES|ARGS_NAMES|ARGS|XML:/* "@rx ^[^!&\(\):<>\|~]*\)[\s\x0b]*(?:\((?:[^!&\(\),<->\|~]+[<>~]?=|[\s\x0b]*[!&\|][\s\x0b]*[\(\)]?[\s\x0b]*)|\)[\s\x0b]*\([\s\x0b]*[!&\|][\s\x0b]*|[!&\|][\s\x0b]*\([^!&\(\),<->\|~]+[<>~]?=[^!&\(\):<>\|~]*)" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a small difference in the second NOT character class:
Old version: [^,\(\)\=\&\|\!<>\~]
New version: [^!&\(\),<->\|~]. -> Difference is the new - instead of the old =.
I don't know if this is on purpose or not.

Besides of that, the regex is identical.

I'll now have a look at the tests, the research papers and if the attacks are detected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've just seen, this is also the same as <-> means <,> and =. So this looks good to me.

Comment thread regex-assembly/921200.ra
Copy link
Copy Markdown
Contributor

@franbuehler franbuehler left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@fzipi fzipi added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit 6b16ca8 Jan 29, 2026
8 checks passed
@fzipi fzipi deleted the regex-assemble/921200 branch January 29, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move regexp from rule 921200 to ra file

5 participants