8000 The Big Backslash Hunt · Issue #2332 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
The Big Backslash Hunt #2332
Closed
Closed
@RedXanadu

Description

@RedXanadu

Motivation

After discussion at the December monthly meeting (#2291), it was decided to standardise on using \x5c to represent the backslash \ character in regular expressions. Some of the reasons we chose this method are:

  • It is portable across engines: it works with Apache, Nginx, and Coraza.
  • It works with the new regexp-assemble.py script.

Alternatives

We (I) had previously started using the pattern [\\\\] in CRS rules. This is an alternative portable backslash representation. It was decided not to adopt this method. For future reference, some of the problems with this method are:

  • It can be confusing and difficult to understand how it works.
  • It doesn't work with the new regexp-assemble.py script.
  • It doesn't work with Coraza.
  • It isn't obvious how to use it in a bracket expression, e.g. [a-zA-Z<portable-backslash>]

Plan

The plan is to tackle each rule individually with a separate PR, to make it simple to track the work and review each rule change.

I'll start by undoing the previous changes I made to move to [\\\\] and will modify those rules to use \x5c instead.

The goal is to use \x5c in all rules and rule building files. There is also a note on the documentation planning wiki page to document how and why we represent backslashes in this way for the benefit of future CRS developers.

Progress

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0