question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The Big Backslash Hunt

See original GitHub issue

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

  • Undo previous [\\\\] changes: convert to using \x5c (undoing PR 2183)
    • Rule 932200 (#2335)
    • Rule 933210 (already done in #2214)
    • Rule 941170 (#2345)
  • Work through the rest of the CRS
    • Rule 941330 (#2375)
    • Rule 942330 (#2376)
    • Rule 920460 (#2399)
    • Rule 930110 (#2400)
    • Rule 932100 ╮
    • Rule 932105 │
    • Rule 932110 │
    • Rule 932115 ├ (#2410)
    • Rule 932150 │
    • Rule 932101 │
    • Rule 932106 ╯
    • Rule 932190 (#2420)
    • Rule 933100 (#2441)
    • Rule 941190 (#2442)
    • Rule 954100 (#2402)
  • Check that all remaining use of \\, \\\\ etc. is legitimate
    • Update comments for rules 932100 and 932110 (#2454)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
RedXanaducommented, Mar 30, 2022

All remaining use of \\\\ is either in tests or submodules, which appear to be legitimate.

As such, this task is complete! Thank you to everyone who helped submit and review PRs along the way 🎉

Closing issue.

2reactions
fzipicommented, Jan 2, 2022

Sure, makes sense. I was thinking on a place were we store a list of “design decisions”, so we don’t forget why we did this 10 years from now 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

BIG SLASH | Lile Real Estate
successful, and well-managed hunting and farming operation that is almost exclusively high fenced, located in the heart of the Arkansas. Delta.
Read more >
Big Slash High Fence? - Arkansas Hunting
has anyone heard of the big slash high fence property outside of holly grove being purchased? From the ranch hands we heard chipper...
Read more >
Backslash Powered Scanning: hunting unknown vulnerability ...
Backslash Powered Scanning: hunting unknown vulnerability classes ... technique is capable of detecting a huge range of vulnerabilities, ...
Read more >
How to Build Your Western Hunting Strategy with Huntin' Fool
How to Build Your Western Hunting Strategy with Huntin' Fool - onX Hunt Masterclass · Try the Hunt App risk free: · Want...
Read more >
Monster Hunter World | Great Sword Tutorial - YouTube
The complete Great Sword tutorial for Monster Hunter World. Everything you want to know, in one place!If you enjoyed the video, don't forget ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found