Commit 61e6d92
committed
fix(signing): block AS112, AMT and ORCHIDv2 special-use ranges
Review follow-up: the deny list covered the two highest-value ranges the
flag check misses, but not the rest of the flag-missed set.
Verified across the whole supported interpreter matrix (3.10, 3.11, 3.12,
3.13) rather than assumed — four more ranges are non-reserved under all
six flags on every one of them:
192.31.196.0/24 RFC 7535 AS112-v4 anycast
192.52.193.0/24 RFC 7450 AMT anycast
192.175.48.0/24 RFC 7534 AS112 direct delegation
2001:20::/28 RFC 7343 ORCHIDv2
None is ever a legitimate JWKS or webhook destination. The ORCHIDv2 entry
also makes the tuple's IPv4|IPv6 annotation accurate rather than
forward-looking.
Three ranges named in the follow-up are NOT added, because the flags
already reject them on every supported version: 6to4 2002::/16, Teredo
2001::/32, and IPv4 NAT64 192.0.0.8 (plus NAT64 64:ff9b::/96 from an
earlier round). Their embedded IPv4 needs no decoding — the whole prefix
is rejected before anything is unwrapped. Since that block depends on
CPython's classification rather than on our list,
test_ssrf_flag_covered_special_ranges_stay_blocked pins it, so a future
reclassification surfaces as a failure instead of a silent hole.
Two corrections to the follow-up, both measured:
- 100.64.0.0/10 is is_private == False on 3.12.9 and 3.13.11, not just on
pre-3.12.4 interpreters. The entry is load-bearing on every supported
version, so no "redundant on newer Python" comment is warranted.
- `not ip.is_global` is not a usable substitute gate: is_global reports
True for the 6to4-relay, AS112, AMT and ORCHIDv2 ranges on every
supported version, so it would close none of these holes.
Also fixes the getaddrinfo mock shape: parametrised cases now build
AF_INET 2-tuple vs AF_INET6 4-tuple sockaddrs via a helper, so the IPv6
cases exercise a record the stdlib would actually produce.
Purely additive rejection of never-legitimate destinations; no public API
change.1 parent b6b3f47 commit 61e6d92
2 files changed
Lines changed: 88 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
71 | 93 | | |
72 | 94 | | |
73 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
74 | 100 | | |
75 | 101 | | |
76 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
| |||
97 | 111 | | |
98 | 112 | | |
99 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
100 | 118 | | |
101 | 119 | | |
102 | 120 | | |
103 | 121 | | |
104 | 122 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
110 | 134 | | |
111 | 135 | | |
112 | 136 | | |
113 | | - | |
| 137 | + | |
114 | 138 | | |
115 | 139 | | |
116 | 140 | | |
117 | 141 | | |
118 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
119 | 175 | | |
120 | 176 | | |
121 | 177 | | |
| |||
0 commit comments