Open dextermallo opened 1 year ago
Did another test, and it can see from the terminal using example code, where
func logError(error types.MatchedRule) {
msg := error.ErrorLog()
fmt.Printf("[logError][%s] %s", error.Rule().Severity(), msg)
}
Hey @dextermallo! Thanks for the report! So, if I have correctly understood, both debug.log
and audit.log
variables are not expanded into the actual value, but it happens on error logs?
Are all your experiments been conducted with the example http-server
or have you used a connector like coraza-caddy?
I will take a look asap
Hey @dextermallo! Thanks for the report! So, if I have correctly understood, both
debug.log
andaudit.log
variables are not expanded into the actual value, but it happens on error logs?
Yes, both debug.log
and audit.log
does not interpret the variables. But the logging shown in the terminal
can see the value.
Are all your experiments been conducted with the example
http-server
or have you used a connector like coraza-caddy?
Yes, I am using the example http-server
and just slightly changed the default.conf
for creating the log files.
Thanks!
You should try using the error callback: https://pkg.go.dev/github.com/corazawaf/coraza/v3#section-readme:~:text=type%20WAFConfig-,%C2%B6,-type%20WAFConfig%20interface
config := coraza.NewWAFConfig().WithErrorCallback(func(rule types.MatchedRule){
fmt.Println(rule)
})
Description
I am doing some experiments on Coraza and found something different from ModSec. When I tried to read from the debug/debug logs, ModSec will interpret variable (e.g., ), whereas Coraza does not, e.g., In ModSec 2/3:
But in Coraza, none of the variables shows its value:
Log configurations:
I also checked the doc and wrote separate rules to test, and it seems I cannot retrieve any tx value from Coraza in audit/error.log. In brief, I can get variables in error/audit from ModSec, whereas both logs cannot get the variables in Coraza
Steps to reproduce
Start ModSec v2.9 / v3 (using docker-crs) and run the following requests. Next, run with Coraza
Expected result
The log should display the variable
ts.variable
Actual result
In the Coraza logs (audit/error), the variable
tx
cannot be interpolated.