wirefilter icon indicating copy to clipboard operation
wirefilter copied to clipboard

Recursive check for nested parameters

Open migolovanov opened this issue 6 years ago • 2 comments

Hello! It is not issue itself, but more like feature request for future: it would be great to perform recursive check of nested parameters. For example, you have JSON as POST-arguments like {"a":{"b":{"c":1}},"d":2} and it is parsed to request.post.a.b.c = 1 and request.post.d = 2. It would be great to set single rule like request.post ~ "^[0-9]+$" to check all nested elements in request.post variable, instead of making separate checks, adopting rule to request.post.a.b.c ~ "^[0-9]+$" and request.post.d ~"^[0-9]+$". In context of HTTP protocol, the same might be applicable for GET-arguments, headers, cookies or any parameter that may contain nested structure.

migolovanov avatar Apr 10 '19 20:04 migolovanov

It doesn't feel very intuitive to be honest, and might be even incompatible with current design, since it's possible to add custom field for request.post in which case request.post ~ "^[0-9]+$" would have a completely different meaning.

RReverser avatar Apr 12 '19 13:04 RReverser

In my opinion, if you've set request.post as string - regex will match this particular string, but if it is nested variable, regex will apply to all child elements. The issue i have met is related to situations when you don't know in advance which variables are set as GET or POST arguments and it is impossible to write a wirefilter rule, that will match all of them. So the only way i found is to rewrite the wirefilter rule for each particular parameter separately (replace parameter in wirefilter condition, create new schema, add arguments and apply filter). I don't know if this case is relevant for you, but just wanted to point out that it may appear.

migolovanov avatar Apr 13 '19 10:04 migolovanov