8000 Improve logging in some special cases by azurit · Pull Request #2347 · coreruleset/coreruleset · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve logging in some special cases #2347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 11, 2022
Merged

Improve logging in some special cases #2347

merged 8 commits into from
Feb 11, 2022

Conversation

azurit
Copy link
Member
@azurit azurit commented Jan 5, 2022

In some cases, matched value (the interesting one) is replaced by something else so logs are not as clear as they could be. This PR is fixing it.

Rule 932200

Log before:
[data "Matched Data: ${ found within MATCHED_VAR: www.google.com;cat /etc/${a}passwd"]

Log after:
[data "Matched Data: ${ found within ARGS:host: www.google.com;cat /etc/${a}passwd"]

Rule 933120

Log before:
[data "Matched Data: = found within ARGS:host: auto_detect_line_endings=gg"]

Log after:
[data "Matched Data: auto_detect_line_endings found within ARGS:host: auto_detect_line_endings=gg"]

Rule 933151

Log before:
[data "Matched Data: ( found within ARGS:host: apache_response_headers(abc)"]

Log after:
[data "Matched Data: apache_response_headers found within ARGS:host: apache_response_headers(abc)"]

@dune73
Copy link
Member
dune73 commented Feb 7, 2022

This is a nice workaround. Thank you.

We do not really have a solution when more than one parameter triggers the rule (that will mess up reporting. But it did so before already, so that's acceptable.).

@azurit
Copy link
Member Author
azurit commented Feb 10, 2022

How am i supposed to catch ( in test output?

@fzipi
Copy link
Member
fzipi commented Feb 10, 2022

Looks like tests are passing! Problem seems to be linting

@azurit
Copy link
Member Author
azurit commented Feb 10, 2022

How am i supposed to use ( in tests?

@fzipi
Copy link
Member
fzipi commented Feb 10, 2022

How am i supposed to use ( in tests?

Exactly how you are doing now?

@azurit
Copy link
Member Author
azurit commented Feb 10, 2022

Tried also unescaped, none is passing lint:
no_log_contains: \( found within

@fzipi
Copy link
Member
fzipi commented Feb 10, 2022

The problem is with extra spaces, not with your string!

See
image

@azurit
Copy link
Member Author
azurit commented Feb 10, 2022

I saw that text but i don't see any problem with spaces on line 103.

@fzipi
Copy link
Member
fzipi commented Feb 10, 2022

Looking at the patch, there is an extra space in the line: + no_log_contains: ( found within , after within. If you need it, just quote the whole line with the space... otherwise remove it.

@azurit
Copy link
Member Author
azurit commented Feb 10, 2022

Thanks, fixed. Was that space really a problem? Isn't this check too sensitive?

@fzipi
Copy link
Member
fzipi commented Feb 10, 2022

Well... sometimes it is a pain. But easy to solve by adding it to your favorite editor!

Copy link
Member
@fzipi fzipi left a comment

Choose a reason for hiding this comment

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

To me this is ready to merge. What I will do in this case is squash those commits so history gets cleaner.

@fzipi fzipi merged commit c0cb98d into coreruleset:v3.4/dev Feb 11, 2022
@azurit
Copy link
Member Author
azurit commented Feb 11, 2022

I will try to squash them next time.

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.

3 participants
0