Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

POST body inspection #12

Open
jvehent opened this issue Jul 1, 2014 · 1 comment
Open

POST body inspection #12

jvehent opened this issue Jul 1, 2014 · 1 comment

Comments

@jvehent
Copy link
Contributor

jvehent commented Jul 1, 2014

We discussed inspecting POST body a few times, and so far concluded that it was too difficult and to costly to do, and we should stick to body size validation instead.

Discussing with @psiinon today, he raised a good point: If we add the format of a POST request into the specification, ZAP could use it as a template to do security tests/fuzzing. The cost issue could be solved by enabling/disabling the filtering at the resource level, and them simply turn it off in production.

Example from https://github.com/mozilla/videur/blob/master/spec/mig_example.json#L73-L106

The flag must_validate controls whether validate is enforced or not, and thus can be turned off in production.
The format field indicates that the POST body, and thus validation field, contains valid JSON.
The validation field is then a standardized version of the expected body, with values replaced with placeholders such as [[datetime]] or [[text]] or [[json]].

{
    "service": {
        "resources": {
            "/action/create": {
                "POST": {
                    "format": "json",
                    "must_validate": false,
                    "validation": {
                        "id": "[[float64]]",
                        "name": "[[text]]",
                        "target": "[[text]]",
                        "description": {
                            "author": "[[text]]",
                            "email": "[[email]]",
                            "url": "[[text]]",
                            "revision": "[float64]"
                        },
                        "threat": {
                            "level": "[[text]]",
                            "family": "[[text]]",
                            "type": "[[text]]"
                        },
                        "validfrom": "[[datetime]]",
                        "expireafter": "[[datetime]]",
                        "operations": [
                            {
                                "module": "[[text]]",
                                "parameters": "[[json]]"
                            }
                        ],
                        "pgpsignatures": [
                            "[[text]]"
                        ],
                        "starttime": "[[datetime]]",
                        "finishtime": "[[datetime]]",
                        "lastupdatetime": "[[datetime]]",
                        "counters": "[[json]]",
                        "syntaxversion": "[[float64]]"
                    }
                }
            }
        }
    }
}
@psiinon
Copy link

psiinon commented Jul 1, 2014

+1 from me - I could definitely use that in ZAP, and I think it would be really useful to have the option to validate JSON POST data.
Gives us basic WAF functionality without all the pain ;)
Theres no reason why this format could not be also used for the std key=value pairs, XML etc etc

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants