Skip to content
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

Avoids buffering bodies when not accessible. Partial fix for Response body buffer #76

Merged
merged 9 commits into from
Nov 15, 2022

Conversation

M4tteoP
Copy link
Member

@M4tteoP M4tteoP commented Nov 9, 2022

This PR:

  • Upgrades Coraza.
  • Enables e2e response body tests.
  • Partially address Only buffer bodies when inspecting it #68 relying on RequestBodyAccessible and ResponseBodyAccessible.
    Note: currently checking for RequestBodyAccessible is not effective because we rely on WithRequestBodyAccess() and it enforces request body access. Opening soon an issue/PR Coraza side.
  • Adds Tests about bodies not buffered if they are not accessible.
    Note: Because of the above mentioned point, one added test is currently commented.
  • Following the proxy-wasm-go-sdk example, refactors how the response body is buffered: The body is just read once (via GetHttpResponseBody) when we reach endOfStream.
    Note: I added the LogDebug related to body sizes because I'm experiencing inconsistent behaviors with OnHttpResponseBody called more than the expected (bodySize>0 but aftwards no extra body is appended to the HttpResponseBody buffer). This behaviour has to be addressed in order to overcome the double-buffering logic and buffer only Coraza side (therefore reading every time new body frame comes and sending it to Coraza)

@M4tteoP M4tteoP changed the title No access no buffer Avoids buffering bodies when not accessible. Partial fix for Response body buffer Nov 9, 2022
@M4tteoP M4tteoP marked this pull request as ready for review November 9, 2022 14:56
@M4tteoP
Copy link
Member Author

M4tteoP commented Nov 15, 2022

Conflict addressed, if you are happy with it, we may merge

@jcchavezs jcchavezs merged commit 6e5f95a into corazawaf:main Nov 15, 2022
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