Skip to content

fix(registry): derive the add-source id from the full IPv6 host - #1776

Merged
Dumbris merged 1 commit into
smart-mcp-proxy:mainfrom
rudycelekli:fix/registry-id-ipv6-host-20261024-01
Oct 26, 2026
Merged

Dumbris merged 1 commit into
smart-mcp-proxy:mainfrom
rudycelekli:fix/registry-id-ipv6-host-20261024-01

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Problem

When registry add-source is called without --id, buildRegistrySourceEntry derives the id from u.Host. deriveRegistryID drops a port by cutting at the first :. For an IPv6 literal source (https://[2606:4700:4700::1111]/), the SSRF check allows a public address, but the cut leaves only [2606. That slugifies to 2606, so every IPv6 registry in the same first group derives the same id, and validateNewRegistrySource refuses the second one as a duplicate.

Fix

Pass u.Hostname(), which already strips the port and the IPv6 brackets, and remove the colon cut from deriveRegistryID. Hostname-based ids are unchanged.

Test

TestBuildRegistrySourceEntry_IPv6HostID covers two IPv6 hosts (one with a port) and two hostnames. On main both IPv6 cases derive 2606; with this change they derive 2606-4700-4700--1111 and 2606-4700--64. The hostname cases are unchanged.

TestBuildRegistrySourceEntry* and the registry-source tests pass. A full local ./internal/server run had only the TestBinary*/TestMCPProtocol* tests that need a prebuilt binary, plus one order-dependent TestSearchServers_CatalogOrderMatchesTheRESTGolden failure that passes when run alone with this change.

Made with Cursor

deriveRegistryID dropped a port by cutting the host at the first ':'.
For an IPv6 literal URL such as https://[2606:4700:4700::1111]/ that
left only the first group, so the id became "2606" and a second
registry in the same /16 was refused as a duplicate id. Pass
u.Hostname(), which already strips the port and brackets, and drop the
cut.
@rudycelekli
rudycelekli force-pushed the fix/registry-id-ipv6-host-20261024-01 branch from c7573cf to ffc5042 Compare October 24, 2026 22:18
@codecov-commenter

codecov-commenter commented Oct 24, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris Dumbris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: the PR test fails on main for the reason described and passes on this branch merged with main; race tests for the touched packages and CI lint (bare and server tags) are clean. Also built and tested together with the rest of this batch, independently reviewed, and cross-reviewed with a second model.

@Dumbris
Dumbris merged commit 6ec9414 into smart-mcp-proxy:main Oct 26, 2026
49 checks passed
@Dumbris

Dumbris commented Oct 26, 2026

Copy link
Copy Markdown
Member

Merged. Thank you, @rudycelekli! IPv6 registry sources derive a full, unique id instead of 2606.

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.

3 participants