corazawaf / coraza-caddy

OWASP Coraza middleware for Caddy. It provides Web Application Firewall capabilities
https://www.coraza.io/
Apache License 2.0
355 stars 41 forks source link

Fix double line break for erros in console output #93

Closed andremralves closed 1 year ago

andremralves commented 1 year ago

It seems that the some error messages already come with a new line from Coraza WAF and the logger used in coraza.go also adds a new line.

So I trimmed the extra "\n" from the message.

image

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

jcchavezs commented 1 year ago

@andrermalves thanks for this contribution. While I think this will solve the problem, I believe the fix should be done in the source of the problem which is Coraza. Are you up to that?

andremralves commented 1 year ago

@andrermalves thanks for this contribution. While I think this will solve the problem, I believe the fix should be done in the source of the problem which is Coraza. Are you up to that?

Yes! So I assume this problem occurs not only with Caddy, but with other web serves as well, right?

Could you give me a direction of which files should I look for in Coraza?

jptosso commented 1 year ago

@andrermalves thanks for this contribution. While I think this will solve the problem, I believe the fix should be done in the source of the problem which is Coraza. Are you up to that?

Yes! So I assume this problem occurs not only with Caddy, but with other web serves as well, right?

Could you give me a direction of which files should I look for in Coraza?

Apparently the error is here: https://github.com/corazawaf/coraza/blob/0dabae31d831f4f6d0f1bb57a1c5adc5cd4f2eb5/internal/corazarules/rule_match.go#L226

M4tteoP commented 1 year ago

This PR has been superseded upstream by https://github.com/corazawaf/coraza/pull/827 (specifically by https://github.com/corazawaf/coraza/pull/827/commits/f421bb04f1dddedecd0b0f756da8bdfa617d539e). Closing this one. @andremralves thanks for raising it and pushing towards the fix!