refactor(mcp): use library CIMD support, drop custom resolver - #655
Merged
Conversation
Upgrade go.lumeweb.com/oauth to v0.1.5, which ships RFC 9291 client identifier metadata document (CIMD) resolution via AuthorizationServer. WithCIMDResolver. Attach a CIMDResolver in NewOAuthServer and delete the pinner-cli-specific CIMD implementation (cache, host allowlist, SSRF, ensureClient/deactivateClient, reaper eviction), now handled by the library's always-on SSRF gate. AS metadata advertises client_id_metadata_document_supported only when a resolver is attached. Remove the CIMD unit tests that covered the deleted custom logic.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Code Coverage ReportTotal Coverage: 50.0% Generated from commit: 01938e5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades go.lumeweb.com/oauth to v0.1.5 and switches the MCP OAuth server to
the library's RFC 9291 CIMD resolution via
AuthorizationServer.WithCIMDResolver.Removes the pinner-cli-specific CIMD implementation (metadata cache, host
allowlist, and client deactivation) in favor of the library's always-on SSRF
gate.
client_id_metadata_document_supportedis advertised only when aresolver is attached, and the now-obsolete CIMD unit tests are removed.
Summary
This pull request refactors the MCP OAuth server to delegate Client-Initiated Backchannel Authentication (CIMD) client metadata resolution to the underlying OAuth library rather than using a custom in-house implementation.
Changes
CIMD Resolution Delegated to Library
WithCIMDResolversupport, which provides RFC 9291 CIMD resolution with its own TTL-based caching and always-on SSRF gateclient_id_metadata_document_supportedonly when CIMD is actually enabledSimplified Server Structure
Cleanup
Impact
This refactor reduces code duplication and potential inconsistencies by leveraging the library's mature CIMD support. The CIMD resolution is now open-by-default (any public HTTPS URL passing the library's SSRF gate is accepted), rather than being restricted to a small hardcoded allowlist of known client hosts, which improves flexibility for legitimate clients while maintaining security through the library's built-in protections.