Skip to content

oauthex: GetProtectedResourceMetadata's strict resource equality blocks RFC 9728-conformant servers #1538

Open

Description

@azilber

oauthex.GetProtectedResourceMetadata (resource_meta.go:135) rejects a PRM whose resource field differs from the URL the client passed, per RFC 9728 §3.3 — but §3.3's model is that the PRM IDENTIFIES the protected resource and the client should request a token FOR the advertised value, not demand it equal the endpoint URL. Servers advertising the issuer form (resource = origin while the endpoint is origin/mcp) are rejected by the strict !=, even though the package already exports oauthex.MatchesResource (audience.go:33) — unused at the validation site.

The SDK's own auth-code flow tolerates this per-candidate (authorization_code.go swallows validation errors and falls back), so only direct callers of the strict helper hit the wall.

Two asks:

  1. Consider MatchesResource-style tolerance (or an opt-out) at the validation site.
  2. Expose a fetch-without-validation variant (getJSON is unexported) so clients can follow §3.3's model without hand-rolling the fetch.

Context: mcpcli (github.com/ConsulTent/mcpcli) hit this against an OAuth-armed MCP appliance enforcing resource indicators and worked around it with a local PRM fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions