Conversation
skoveit
marked this pull request as ready for review
August 7, 2026 19:25
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.
What this change solves
The CIMD (Client ID Metadata Document) SSRF guard only inspected an address's IPv6 bits, so IPv6 transition addresses such as
64:ff9b::a9fe:a9fepassed everynet.IPpredicate while still routing to169.254.169.254. This change decodes the IPv4 address embedded in NAT64, IPv4-compatible, IPv4-translated, 6to4, and Teredo addresses and blocks the address if either the outer IPv6 address or the embedded IPv4 address lands in private space.Change Type
Bug fix
Description
isBlockedIP(net.IP) boolpredicate and use it at all three guard sites: the literal-IP path and the DNS-resolution path of the renamedisBlockedHost, and theDialContexthook innewSafeHTTPClient.embeddedIPv4to decode the IPv4 address wrapped by NAT64 (RFC 6052), IPv4-compatible (RFC 4291), IPv4-translated (RFC 6145), 6to4 (RFC 3056), and Teredo (RFC 4380) addresses;isBlockedIPtests both the outer address and the decoded one.64:ff9b:1::/48(NAT64 local use, RFC 8215) wholesale, since the embedded IPv4 offset varies with the deployment's prefix length.IsUnspecifiedandIsMulticast, replacing the narrowerIsLinkLocalMulticast.isPrivateOrLoopbacktoisBlockedHostto reflect that it now covers more than private and loopback ranges.TestIsBlockedIPcovering each transition format in both blocked and allowed directions, and extendTestIsBlockedHostwith a NAT64-wrapped cloud-metadata case.Diagram Walkthrough
File Walkthrough