fix(api): reject private IP literals before proxy dispatch - #4273
Open
ibondarenko1 wants to merge 3 commits into
Open
fix(api): reject private IP literals before proxy dispatch#4273ibondarenko1 wants to merge 3 commits into
ibondarenko1 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
PROXY_SERVERis configured, thesafeFetchconnection check sees theproxy socket's
remoteAddress, not the requested destination. A private IPliteral is blocked without a proxy but can reach the dispatcher when the proxy
itself has a public address.
The controlled API reproduction used the same
http://127.0.0.1:9911/secrettarget in both cases. The direct request wasblocked and did not reach the target. Through a restricted researcher-owned
proxy, the request reached the target and returned its marker.
Change
Add a destination interceptor before
ProxyAgentdispatch. It rejects privateIPv4 and IPv6 literals on the initial request and redirects, using the existing
InsecureConnectionError.ALLOW_LOCAL_WEBHOOKS=trueremains the explicitopt-in for local destinations.
The interceptor does not resolve hostnames locally. A proxy can use a different
DNS view, so proxy-side DNS and rebinding protection are still required.
Validation
git diff --checkALLOW_LOCAL_WEBHOOKS=trueallowedThis is a defense-in-depth change and does not replace the documented
requirement for a proxy that blocks private and link-local destinations.
Summary by cubic
Block private IP literal targets in
safeFetchbeforeProxyAgentdispatch to close a proxy bypass gap, including during redirects.ALLOW_LOCAL_WEBHOOKS=truestill allows local targets.rejectPrivateIPLiteralTargetsundiciinterceptor to reject private IPv4/IPv6 literals withInsecureConnectionError.ALLOW_LOCAL_WEBHOOKSopt-in, and blocking redirects to private targets without reaching them.Written for commit c38f8ab. Summary will update on new commits.