Repository navigation
fix(ssrf): unwrap IPv6 transition addresses in the URL guard - #19517
Conversation
The shared SSRF guard checked the resolved address with is_global / IsLoopback|IsPrivate but never looked at the IPv4 address embedded in an IPv6 transition address. An AAAA record like 64:ff9b::a9fe:a9fe (NAT64 wrapping 169.254.169.254) or 2002:7f00:1::1 (6to4 wrapping 127.0.0.1) passed the check, so a caller could still reach cloud metadata or a loopback service. Unwrap 6to4, NAT64, Teredo and the deprecated IPv4-compatible form and re-check the embedded address, in the Go guard and its Python mirror. A NAT64 address wrapping a public IPv4 stays allowed. Same class as CVE-2026-73087 (Dozzle).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe SSRF guards now normalize IPv6 addresses that contain IPv4 values and reject non-global embedded destinations. Tests cover zero-network IPv4, 6to4, NAT64, Teredo, IPv4-compatible addresses, and public NAT64 targets. ChangesSSRF validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The guards now reject embedded private, loopback, and metadata-service addresses while allowing public NAT64 destinations. The added coverage and reported checks support merging with no concrete blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. A rabbit checks each address bright Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19517 +/- ##
=======================================
Coverage 37.37% 37.37%
=======================================
Files 54 54
Lines 15374 15374
Branches 125 125
=======================================
Hits 5746 5746
Misses 9601 9601
Partials 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
The shared SSRF guard (
common/ssrf_guard.pyand its Go mirrorinternal/utility/ssrf.go) resolves the target hostname and rejects it if any resolved address is not globally routable. The routability check looks at the address as-is but never unwraps the IPv4 address embedded in an IPv6 transition address, so a hostname whose AAAA record is something like64:ff9b::a9fe:a9fe(NAT64 well-known prefix wrapping169.254.169.254) or2002:7f00:1::1(6to4 wrapping127.0.0.1) passes the guard. In a deployment that has NAT64/DNS64 (common for IPv6-only clusters) that address routes to the embedded IPv4, so a user-supplied URL fed to the crawler, the Invoke component, the markdown image loader, the data-source connectors, etc. can still reach the cloud metadata endpoint or a loopback service.This unwraps 6to4, NAT64 (well-known and local-use prefixes), Teredo and the deprecated IPv4-compatible form and re-checks the embedded address in both implementations. A NAT64 address that wraps a public IPv4 stays allowed so IPv6-only egress keeps working. On the Go side I also added a
0.0.0.0/8check, which Python'sis_globalalready covered. This is the same class as CVE-2026-73087 (Dozzle) and GHSA-4q5r-r938-8xr2 (eKuiper).The other Go guards (
internal/agent/tool/ssrf.go,internal/parser/parser/markdown_parser.go,internal/syncer/connector/rest_api.go) have the same gap and could get the same treatment in a follow-up;internal/service/agent_dbcheck.goalready blocks these prefixes.Testing
go test ./internal/utility/and the newtest/unit_test/common/test_ssrf_guard.pypass. I confirmed fail-before/pass-after for each new case (the transition-address URLs are accepted by the current guard and rejected after the change), and the existing guard test cases still pass. Rangofmt,go vetandruffon the touched files.