summaryrefslogtreecommitdiff
path: root/json/tests/draft2020-12/optional/format/ipv4.json
blob: e36a3816fbfe78a5a3c9b19992c7247d9102f641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[
    {
        "description": "validation of IP addresses",
        "schema": {"format": "ipv4"},
        "tests": [
            {
                "description": "a valid IP address",
                "data": "192.168.0.1",
                "valid": true
            },
            {
                "description": "an IP address with too many components",
                "data": "127.0.0.0.1",
                "valid": false
            },
            {
                "description": "an IP address with out-of-range values",
                "data": "256.256.256.256",
                "valid": false
            },
            {
                "description": "an IP address without 4 components",
                "data": "127.0",
                "valid": false
            },
            {
                "description": "an IP address as an integer",
                "data": "0x7f000001",
                "valid": false
            },
            {
                "description": "an IP address as an integer (decimal)",
                "data": "2130706433",
                "valid": false
            },
            {
                "description": "leading zeroes should be rejected, as they are treated as octals",
                "comment": "see https://sick.codes/universal-netmask-npm-package-used-by-270000-projects-vulnerable-to-octal-input-data-server-side-request-forgery-remote-file-inclusion-local-file-inclusion-and-more-cve-2021-28918/",
                "data": "087.10.0.1",
                "valid": false
            },
            {
                "description": "value without leading zero is valid",
                "data": "87.10.0.1",
                "valid": true
            }
        ]
    }
]