Skip to content

Add RFC 9728 resource field validation for protected resource metadata discovery #1581

@maxisbey

Description

@maxisbey

Problem

PR #1548 implemented SEP-985 fallback discovery but is missing a critical security requirement from RFC 9728 Section 3.3.

RFC 9728 Section 3.3 requires: The resource field in protected resource metadata responses MUST be validated to match the expected resource identifier. If values don't match, the metadata MUST be rejected.

This validation prevents impersonation attacks where a malicious server returns metadata claiming to describe a legitimate resource but containing attacker-controlled authorization servers.

What's Needed

Client must validate:

  1. Same origin validation: Resource field must have same scheme, host, and port as the server
  2. Path validation for path-based discovery: When using /.well-known/oauth-protected-resource/{path}, the resource field must match or be a valid parent of the expected path
  3. Fallback on mismatch: Reject invalid metadata and try the next discovery URL in the fallback chain

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Significant bug affecting many users, highly requested featureauthIssues and PRs related to Authentication / OAuthbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions