fix: format IPv6 endpoints for integrations - #786
Conversation
ddfa57d to
32469dc
Compare
32469dc to
eebe93e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eebe93e3de
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if percent < 0 || !strings.Contains(host[:percent], ":") || strings.HasPrefix(host[percent:], "%25") { | ||
| return host |
There was a problem hiding this comment.
Encode raw zone IDs that begin with 25
When the raw IPv6 zone itself starts with 25 (for example, the common numeric interface index in fe80::5%25), this prefix check mistakes it for an already URL-encoded delimiter and returns ssl://[fe80::5%25]:8883. url.Parse, as used by Paho's AddBroker, decodes that host to [fe80::5%]:8883, which cannot be resolved, so Nova never connects on that interface. The input representation must be canonicalized or otherwise disambiguated rather than treating every %25... suffix as pre-encoded.
Useful? React with 👍 / 👎.
Summary
net.JoinHostPortafter removing brackets only from valid IPv6 literal host parts.%25in Nova broker URLs, while preserving already encoded%25without double-escaping.Why
Issue #725 identifies malformed
host:portstrings for bare IPv6 literals. The independent review of #786 also found that already bracketed input became[[fd00::5]], and that Nova broker URLs rejected raw IPv6 zone IDs such asfe80::5%en0. Nova URL zone IDs now follow RFC 6874.Scope and non-overlap
security.gois untouched.go/internal/drivers/registry.goremain outside this PR and their existing owners.Checks
Passed locally on
eebe93e3, rebased on livemaster6d4b958a7e29b52fac69b4c919f99e4409c41348:make verifymake verifymake verify-all(including Linux arm64/amd64 and Windows amd64 cross-builds)go test ./internal/api ./internal/evcloud ./internal/nova -count=1