Minimal overhead mechanism for feeding body data if buffers already available #832
Replies: 6 comments 2 replies
-
Coraza does not mutate the body, we have this method to be able to reuse a
slice of bytes
https://github.com/corazawaf/coraza/blob/main/internal/corazawaf/transaction.go#L787.
what connector are you using?
…On Sat, 1 Jul 2023, 14:19 Mohit Joshi, ***@***.***> wrote:
I already have the request / response body in local buffers and want to
feed Coraza for analysis. Is there a way to feed this to
ProcessRequestBody/ProcessResponseBody with minimal overhead of copying in
separate buffers. Does the coraza internally changes these buffer so a copy
is must
—
Reply to this email directly, view it on GitHub
<#832>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYATMX5XFPFRVPJ2DGHTXOAIULANCNFSM6AAAAAAZ2YPPAU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You can flush your body while feeding coraza then replace your reader with coraza buffer reader. That way you avoid maintaining the body in memory twice. |
Beta Was this translation helpful? Give feedback.
-
Only caveat on using coraza buffets is that coraza buffers the body up to a
limit and not entire body.
…On Sat, 1 Jul 2023, 14:27 Juan Pablo Tosso, ***@***.***> wrote:
You can flush your body while feeding coraza then replace your reader with
coraza buffer reader. Coraza reader behaves different depending on the
configuration, you might get a memory copy or a pointer to the file reader.
Coraza doesn't change the request or response bodies. It is safe to
extract it from coraza.
—
Reply to this email directly, view it on GitHub
<#832 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYASOL3IPKOIR42RCSKLXOAJUVANCNFSM6AAAAAAZ2YPPAU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Cc @anuraaga
…On Sat, 1 Jul 2023, 14:43 Mohit Joshi, ***@***.***> wrote:
Thanks for this... I did see this but could it is making a copy. I have
started experimenting with Coraza so do not have a good understanding here.
... it is a proprietary connectors sending data over REST interface . But
in the processing pipeline I am deep to use the buffer to reuse the buffer
coming back from coraza, so was just looking for some interface in which a
existing data-buffers could be reused by coraza ... I am just experimenting
a few things here
Thanks a lot for quick response here
—
Reply to this email directly, view it on GitHub
<#832 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYAWMMSF7RDUZEVF4ANTXOALPJANCNFSM6AAAAAAZ2YPPAU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Maybe be could expose a `unsafeUseRequestBody` and accept a body buffer
because we also reject based on length.
…On Sat, 1 Jul 2023, 14:51 José Carlos Chávez, ***@***.***> wrote:
Cc @anuraaga
On Sat, 1 Jul 2023, 14:43 Mohit Joshi, ***@***.***> wrote:
> Thanks for this... I did see this but could it is making a copy. I have
> started experimenting with Coraza so do not have a good understanding here.
> ... it is a proprietary connectors sending data over REST interface . But
> in the processing pipeline I am deep to use the buffer to reuse the buffer
> coming back from coraza, so was just looking for some interface in which a
> existing data-buffers could be reused by coraza ... I am just experimenting
> a few things here
> Thanks a lot for quick response here
>
> —
> Reply to this email directly, view it on GitHub
> <#832 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAXOYAWMMSF7RDUZEVF4ANTXOALPJANCNFSM6AAAAAAZ2YPPAU>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
I think some example code could work, what would you expect from such a
method to accept as parameter?
…On Sun, 2 Jul 2023, 15:29 Mohit Joshi, ***@***.***> wrote:
Once I get a better can pick it up
—
Reply to this email directly, view it on GitHub
<#832 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXOYAQLKRV3575MAIVP67DXOFZTFANCNFSM6AAAAAAZ2YPPAU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I already have the request / response body in local buffers and want to feed Coraza for analysis. Is there a way to feed this to ProcessRequestBody/ProcessResponseBody with minimal overhead of copying in separate buffers. Does the coraza internally changes these buffer so a copy is must
Beta Was this translation helpful? Give feedback.
All reactions