Recommendations on handling SSRF? #2567
Unanswered
SorteKanin
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking into using
reqwest
with user-submitted URLs, which brings some danger due to server-side request forgery.One possible way I can see to handle this is to use a custom DNS resolver via the
dns_resolver
method, then verify that the resolved IP is a "normal" public IP and not an internal/private/reserved IP.However, I'd prefer if there was a way I could do this without touching the DNS resolution, as I really want to just perform some checks on the resolved IPs. I'm also concerned if this is adequate to protect against SSRF in general.
Any suggestions or is
dns_resolver
the way to go? Would a feature request for something along these lines make sense? Maybe an easy security function in the same vein as.https_only(true)
would be nice, like.public_ips_only(true)
?For example, I was thinking something along these lines, but it forces me to override the DNS and that's kind of tangential to my goal here:
Beta Was this translation helpful? Give feedback.
All reactions