Skip to content

docs(oauthex): correct MatchesResource trailing-slash description - #1339

Merged
guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
PratikDhanave:docs/oauthex-matchesresource-comment
Oct 4, 2026
Merged

guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
PratikDhanave:docs/oauthex-matchesresource-comment

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

MatchesResource's doc says the relaxation is "narrowed to the empty-path case" and that all other components "must match exactly". But the implementation compares strings.TrimSuffix(resource, "/") against strings.TrimSuffix(c, "/"), which folds a single trailing slash on any path — so e.g. https://h/a/ and https://h/a compare equal, which the old wording said must not happen.

The broad trailing-slash fold is intentional (see the function's own Background paragraph), so this corrects the description to match the code. Audience (aud) matching behavior is unchanged; doc-only.

go build ./..., go vet ./oauthex/, go test ./oauthex/ pass.

🤖 Generated with Claude Code

The doc comment said the relaxation was "narrowed to the empty-path case" and
that all other components "must match exactly". The implementation compares
strings.TrimSuffix(resource, "/") against strings.TrimSuffix(c, "/"), which
folds a single trailing slash on ANY path, not just the empty-path case. So
e.g. "https://h/a/" and "https://h/a" compare equal — which the old comment
said must not happen. The broad trailing-slash fold is intentional (see the
function's own Background paragraph), so this corrects the description to match
the code; audience (aud) matching behavior is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@guglielmo-san
guglielmo-san merged commit c1ed348 into modelcontextprotocol:main Oct 4, 2026
9 checks passed
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.

2 participants