fix(core): reject bracketed IPv6 in web viewport URL validation#84
fix(core): reject bracketed IPv6 in web viewport URL validation#84hyperb1iss wants to merge 1 commit into
Conversation
|
Warning Review limit reached
More reviews will be available in 58 minutes and 27 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Motivation
http://[::1]:8080/) becauseUrl::host_str()returns bracketed IPv6 andhost.parse::<IpAddr>()fails, enabling an SSRF-style bypass; this change closes that gap.Description
host_as_ip(host: &str) -> Option<IpAddr>that strips[/]from IPv6 literals before parsing toIpAddrand wire it intovalidate_web_urlso bracketed IPv6 and IPv4-mapped IPv6 addresses are classified correctly.host.parse::<IpAddr>()branch withhost_as_ip(host)invalidate_web_urlto ensure the private/loopback check runs for IPv6 literals.host_as_ip_handles_bracketed_ipv6_literalsandvalidate_web_url_rejects_bracketed_private_or_loopback_ipv6to prevent regressions.Testing
crates/hypercolor-core/src/effect/builtin/web_viewport.rsthat cover bracketed IPv6 parsing and rejection byvalidate_web_url.cargo test -p hypercolor-core web_viewport, but the run failed in this environment due to a missing native dependency (libpipewire-0.3) required bylibspa-sys, so the tests could not be executed here.Codex Task