You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Too easy to avoid hostname blocklist in safe_requests #14
Need to harden against all possible permutations allowed by inet_aton https://linux.die.net/man/3/inet_aton. Should be easiest to attempt to parse the host with inet_aton and check the resulting integer.
There's actually a large number of ways to express 192.168.1.1 as a valid IPv4 address. Here's a small sample of IP addresses that all resolve to 192.168.1.1:
The address supplied in cp can have one of the following forms: a.b.c.d, a.b.c, a.b, a
In all of the above forms, components of the dotted address can be specified in decimal, octal (with a leading 0), or hexadecimal, with a leading 0X).
changed the title [-]Add some alternatives for 192.168.1.1 and 169.254.169.254 in safe_requests[/-][+]Too easy to avoid hostname blocklist in `safe_requests`[/+]on Feb 22, 2024
@tjs-intel thanks this is also extremely helpful feedback. It would be good to see whether there's some prior art for this kind of thing or whether we should just build it ourselves.
@tjs-intel this is pretty interesting! It would be cool if there were Python bindings or if a similar project existed for native Python. In either case maybe we can use it for inspiration here.
Activity
tjs-intel commentedon Feb 22, 2024
@drdavella
tjs-intel commentedon Feb 22, 2024
There's actually a large number of ways to express 192.168.1.1 as a valid IPv4 address. Here's a small sample of IP addresses that all resolve to 192.168.1.1:
https://linux.die.net/man/3/inet_aton
[-]Add some alternatives for 192.168.1.1 and 169.254.169.254 in safe_requests[/-][+]Too easy to avoid hostname blocklist in `safe_requests`[/+]drdavella commentedon Feb 23, 2024
@tjs-intel thanks this is also extremely helpful feedback. It would be good to see whether there's some prior art for this kind of thing or whether we should just build it ourselves.
tjs-intel commentedon Feb 26, 2024
The C implementation of
inet_atoncan be accessed viasocket.inet_aton.But you could also enforce that the IPv4 address conforms to the 4-part dotted decimal format, and raise some kind of exception if it doesn't.
drdavella commentedon Feb 26, 2024
That seems reasonable to me; @matt- any thoughts?
tjs-intel commentedon Mar 11, 2024
For your consideration https://github.com/stripe/smokescreen
drdavella commentedon Mar 11, 2024
@tjs-intel this is pretty interesting! It would be cool if there were Python bindings or if a similar project existed for native Python. In either case maybe we can use it for inspiration here.