mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
The /api/meta-extraction endpoint fetches the supplied URL server-side, so an authenticated caller could previously point it at internal services or cloud metadata (169.254.169.254). The 'url' field only used Laravel's 'url' rule, which accepts any scheme and any host. Add a PublicHttpUrl rule that: - restricts the scheme to http/https - rejects localhost / *.localhost and IDN/punycode variants - rejects bare IPs and hostnames resolving to loopback, RFC1918, RFC6598 CGNAT, link-local (169.254/16, fe80::/10), ULA, multicast, reserved and IPv4-mapped-IPv6 ranges (explicit CIDR matching for both v4 and v6), failing closed when a host cannot be resolved. Covered by unit tests for the rule and a feature test asserting the endpoint rejects internal/non-http URLs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>