-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Allow to parse JSON/XML inside specific variables #917
Comments
+1 |
QQ: couldn't you achieve the same with a custom multipart body processor coraza/internal/bodyprocessors/multipart.go Lines 20 to 21 in 476a178
|
I thought about this, but it seems a bit impractical: you would need one custom processor for multipart+XML, one for multipart+JSON, one for urlencoded+XML, and one for urlencoded+JSON no? And probably the most difficult thing, you have to set the body processor very early when processing a request, but this is not something that would always be possible.
and
In this case, you would need to first process the body before knowing which var should be decoded. Without looking at the code, I think maybe having some kind of lazy parsing would be the best bet: If the user tries to access |
I think we should update the body processor interfaces and add some feature to handle other sources of data. |
So we are talking about an ARGS processor? Is there any standard situation for this? Like all the examples you mentioned look like specific behaviours so I wonder if we should be declaring this programatically rather than through a seclang.
I remember proposing this to @jptosso but he had a point about variables being flattened for a reason. |
Some discussion already happened in #456 |
Summary
Currently, it is only possible to parse JSON/XML at the body level and not for specific variables.
This makes it a bit tricky (or impossible, especially in the case of XML) to write rules to match on specific variables containing JSON or XML.
Basic example
With a request like this:
I'd like to be able to access the parsed JSON as any over variable with something like
ARGS_POST:jsonVar.json.foo
The text was updated successfully, but these errors were encountered: