feat: add RFC 8707 Resource Indicators support#879
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Implements RFC 8707 (Resource Indicators for OAuth 2.0) by parsing the standardized "resource" form parameter alongside the existing non-standard "audience" parameter. The "resource" values are validated per RFC 8707 §2 (absolute URI, no fragment) and merged into the RequestedAudience list, so they flow through fosite's existing audience binding pipeline (DefaultAudienceMatchingStrategy and the per-flow audience checks) and end up in the issued token's aud claim with no additional plumbing. Motivation: the 2026 MCP (Model Context Protocol) spec mandates RFC 8707 to prevent confused-deputy attacks between MCP servers. Several public AS implementations now support it; this aligns fosite with the broader OAuth 2.1 / MCP ecosystem. Changes: audience_strategy.go merges resource with audience and adds ValidateResourceIndicators helper; access_request_handler.go validates resource before populating RequestedAudience; new unit and integration tests cover merging, de-dup, and invalid input cases. Backward compatibility: requests with only the "audience" parameter behave exactly as before. The "resource" parameter is opt-in. Signed-off-by: cohendvir <dvir@honeybook.com>
6560f1a to
54bfd0b
Compare
|
Shouldn't this be in the authorize code / implicit auth handlers and refresh / client credentials / device code access handlers? |
|
Actually looking more closely it's similar to refresh flow, the values requested on the auth endpoint restrict what can be requested on the token endpoint, same for the original request in refresh flows.
|
Adds support for RFC 8707 Resource Indicators in fosite.