fix(discovery): authorize exact-name GossipSub tool results - #290
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces verification for gossip tool rows in the MCP handlers. Unsolicited announcements are now treated as routing hints and verified through authenticated MCP sessions using the new verifyGossipToolRows and fetchRemoteToolDescription methods. A comprehensive unit test has been added to ensure correct authentication and label preservation. The review feedback suggests a minor optimization to return early from verifyGossipToolRows if the candidates slice is empty, avoiding unnecessary resource allocation and goroutine overhead.
|
@aojea This is ready for maintainer review. It closes the exact-name GossipSub authorization gap in #176 by treating announcements as candidates and confirming each through an authenticated service-specific MCP |
|
Thanks |
Summary
Addresses the exact-name discovery gap in #176.
The GossipSub fast path previously returned
ServiceAnnouncerows directly. Announcements are useful routing hints, but they do not prove that the current caller is authorized to access the advertised MCP service.This change:
tools/listbefore returning itdescribe_remote_toolThere is no dependency, wire-format, or policy-model change.
Regression coverage
The new test advertises two services on the same peer with the same tool name. The caller's Biscuit authorizes one service and denies the other. Only the authenticated service is returned, with its description populated from the verified MCP session.
Validation
Both pass.
I also ran
go test ./... -count=1in an unprivileged Go 1.25.7 container. The changed package and neighboring packages passed. The repository-wide command remained red on two environment-specific checks outside this patch: the Windows-copied embedded skill fixture retained CRLF, andTestSamBoxNanoInitIntegrationcould not callunsharein the unprivileged container.