Skip to content

Reject private and loopback IPs in checkMetadataURL#21

Merged
andrew merged 1 commit intomainfrom
fix/check-metadata-url-ssrf
May 2, 2026
Merged

Reject private and loopback IPs in checkMetadataURL#21
andrew merged 1 commit intomainfrom
fix/check-metadata-url-ssrf

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 2, 2026

`checkMetadataURL` validated the scheme and presence of a host but accepted any IP, including `127.0.0.1`, `169.254.169.254`, and `::1`. A compromised registry response could point download URLs at cloud metadata endpoints or internal services.

Now resolves the hostname to an IP and rejects loopback, private, and link-local addresses. The redirect-following bypass noted in the existing code comments is left for the `Transport.DialContext` approach scoped in PR #15.

The URL check accepted any HTTPS host including loopback, link-local,
and private IPs. A compromised registry could point download URLs at
cloud metadata endpoints or internal services. Now resolves the
hostname and rejects private, loopback, and link-local addresses.
@andrew andrew merged commit d7883ae into main May 2, 2026
2 checks passed
@andrew andrew deleted the fix/check-metadata-url-ssrf branch May 2, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant