-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block direct requests to private IPs #529
Block direct requests to private IPs #529
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, TIL https://pkg.go.dev/net#IP.IsPrivate
This will still resolve hosts pointed to by DNS records. For example if we'd have an A record saying |
That should be handled via the ignored hosts imo. It might be worthwhile to add a config option for ignored hosts, since as of now they can only be added by patching the source. |
Go's HTTP client has a way to customize parts of the transport layer, see https://pkg.go.dev/net/http#Client and https://pkg.go.dev/net/http#RoundTripper - with this we should be able to intercept the request after the domain resolving has happened & stop it mid-transit instead |
I was not able to find a way to intercept requests after the domain resolving. If this is not feasible, we could instead make the ignored hosts configurable and maybe add common hosts (e.g. localhost) as a default entry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good first effort, so I will go ahead and merge this in as-is, but I won't close #480
Thanks!
Pull request checklist:
CHANGELOG.md
was updated, if applicableDescription