Replies: 4 comments 5 replies
-
@fzipi @jcchavezs Would you be open to making this configurable? As in, by default, the transaction ID would be a 16 char random string, but making it configurable to something like |
Beta Was this translation helpful? Give feedback.
-
I would be ok with replacing the unique ID from Coraza with {http.request.uuid}. @fzipi @jcchavezs ? That should make it work by default |
Beta Was this translation helpful? Give feedback.
-
This is something I brought over the table long ago but I didn't want to go
beyond with an actual user request. this is the issue
#711 and i would be more than
happy to bring this to completion but I have a question: Are we talking
about debug logs (aka logs) from coraza or audit logs where matched
information is requested?
in your example:
```
{"level":"error","ts":1722411224.4220889,"logger":"http.handlers.waf","msg":"[client
\"10.63.4.168\"] Coraza: Access denied (phase 2). Javascript method
detected [file \"/etc/caddy/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf\"]
[line \"8411\"] [id \"941390\"] [rev \"\"] [msg \"Javascript method
detected\"] [data \"Matched Data: alert( found within
ARGS:currentScreen: <script>alert(“TEST52”);</script>\"] [severity
\"critical\"] [ver \"OWASP_CRS/4.6.0-dev\"] [maturity \"0\"] [accuracy
\"0\"] [tag \"application-multi\"] [tag \"language-multi\"] [tag
\"attack-xss\"] [tag \"xss-perf-disable\"] [tag \"paranoia-level/1\"]
[tag \"OWASP_CRS\"] [tag \"capec/1000/152/242\"] [hostname \"\"] [uri
\"/?currentScreen=%3Cscript%3Ealert(%E2%80%9CTEST52%E2%80%9D);%3C%2Fscript%3E\"]
[unique_id \"xvXkQcxmIEeFIjej\"]\n"}
```
In coraza http middleware we inject the context from the request into
the transaction, see
https://github.com/corazawaf/coraza/blob/010509a151e309609a2f7ccd174afe4bc9663a18/http/middleware.go#L125-L132.
In caddy we could do the same but also add another setting to add a
logContextExtractor or something like that so on every context we
extract the http-request-id and inject into the logger.
I would be ok with replacing the unique ID from Coraza with {http.request.uuid}. @fzipi <https://github.com/fzipi> @jcchavezs <https://github.com/jcchavezs> ? That should make it work by default
I don't think this would work as every internal call have the same
request-id and hence all transactions created from different services
will have the same id.
|
Beta Was this translation helpful? Give feedback.
-
Hi, I'm currently having the same issue in the coraza-proxy-wasm. But it only logged this information in non-rule messages, like:
And nothing happened in rule messages, like:
In the same function, I tried to access the rules captured by the transaction (as in the snippet below), but it did not work because I could only get the values, and not set new values (I noticed there are no "set" methods).
Is there another way to implement this idea in the coraza-proxy-wasm version? |
Beta Was this translation helpful? Give feedback.
-
I'm using coraza-caddy. Great project. ❤️
The incoming requests into Caddy server have a
x-request-id
header. I want to include the value of this header into the logs somehow. The use case is for us to search for a specific request ID in our log management tool, and be able to see and trace all logs for that request in our reverse proxy log, Coraza log, Caddy log, upstream backend log etc.I could individually change the
msg
orlogdata
action of each rule to include%{REQUEST_HEADERS.X-Request-ID}
, but that's not maintainable and scalable. So I'm wondering if this use case was already thought of, or if there is a workaround to make it work, such as adding a tag to all the rules viacrs-setup.conf
, or appending themsg
orlogdata
actions on the fly, or something of that nature.Beta Was this translation helpful? Give feedback.
All reactions