-
Notifications
You must be signed in to change notification settings - Fork 27
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
"deny" action still passes the request down the filter chain? #171
Comments
First of all, thanks @dspeg for reporting this. What you are experiencing comes from a conceptually different behavior on how the request is handled by Envoy.
In order to handle this problem we are mainly taking into account the following ideas:
Any early feedback, comment, or idea is very welcome! |
More background info regarding the original issue:
|
I did another round of testing. Note that I'm using a Wasm file built from a snapshot of the coraza-proxy-wasm project, with latest commit on Feb. 16, 2023.
Below are the logs:
After I sent "ctrl-c" to "curl", I saw additional logs:
|
After removing the config "SecRequestBodyAccess Off", I can still reproduce the problem.
|
Let's dig into it.
We can expect a curl request like:
We don't care about body access, therefore I'm guessing that the rule that we are running is checking something related to phase:1 (e.g. REQUEST_HEADERS or get ARGS)
Request Lifecycle:
It happens because during phase 1 we already had elements that could have been evaluated, but it actually not happened, because the rule was expected to be executed only in phase 2. In the meanwhile, Envoy already started the connection to the application and started to stream data. This is exactly the use-case that we are targeting with the MultiPhase evaluation, even if
About this point, seeing the log line |
Thank you so much for going into the details to explain the issue! I will run the testing suggested.
I see a Multi Phase evaluation PR mentioned had been merged in Jan. 2023. We need more changes to support this feature? Since my Wasm file was built in Feb. 2023, and multi phase evaluation is not working properly. The suggested change to add "tx.early_blocking=1" to rule config should help some other cases. But it does not help my test case, and this is expected. |
I have dumped more response headers using the provided wasm file. Still no response is received by "curl".
|
Hi, I mainly pointed you all the PRs related to MultiPhase to give context about the ongoing work upstream (in the Coraza repo). A wasm file built in Feb. 2023 does not support multiphase, the feature has to be enabled at build time, and currently, it is not added in the main wasm build. |
Addressed by multiphase evaluation that is enabled by default (see #194) |
Discussed in corazawaf/coraza#770
Originally posted by dspeg April 12, 2023
I am testing the Coraza Wasm Plugin on Envoy/Istio. I set up a SecRule to block certain requests in Phase 2 along with the setting
SecDefaultAction "phase:2,log,deny,status:403"
. When a request is blocked by this rule, the client gets back the expected status code "403". However the application protected by the Coraza WAF still receives the request and processes it. This is not expected.I'm not sure whether I have misconfigured Envoy/Istio or I have missed some Coraza rules or configs. Please help troubleshoot this issue. Thanks!
The text was updated successfully, but these errors were encountered: