| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…source BearerAuthBackend takes an optional resource_server_url; when it is set, only a token the verifier reports as issued for that URL (AccessToken.resource, the RFC 8707 resource indicator, compared as a URL with a trailing slash tolerated) is accepted, and anything else is answered 401 like an unrecognized token. AuthSettings.validate_token_resource (default False) turns this on for the Streamable HTTP and SSE apps; it requires resource_server_url. TokenVerifier.verify_token's docstring and docs/run/authorization.md say where the token's audience goes and when to enable the option versus checking the audience in the verifier. The simple-auth example enables it. The interaction suite enables it for the bearer tests and records that it is off by default on hosting:auth:aud-validation.
📚 Documentation preview
|
Sorry, something went wrong.
There was a problem hiding this comment.
1 issue found across 12 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/run/authorization.md">
<violation number="1" location="docs/run/authorization.md:26">
P2: When introspection returns an array-valued `aud`, the bundled verifier forwards the array as `AccessToken.resource`, so Pydantic rejects the token before resource validation. Update the example verifier to select the URL-matching audience and reject the token when none matches.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Sorry, something went wrong.
RefreshToken gains an optional resource (RFC 8707 resource indicator) that a provider propagates to refreshed access tokens, as it does subject, so a server with validate_token_resource keeps accepting tokens after a refresh. The interaction suite's provider does so and a lifecycle test covers it. Also: log the reported resource with %r; note in the docs that resource_server_url should be the exact endpoint URL when the option is on; pin the default-off behaviour with an interaction test; have the simple-auth verifier pick the aud entry for this server when aud is a list.
There was a problem hiding this comment.
All reported issues were addressed across 8 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Sorry, something went wrong.
There was a problem hiding this comment.
t
Sorry, something went wrong.
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Sorry, something went wrong.
validate_token_resource becomes bool | None (default None). With a resource_server_url configured and no explicit choice, AuthSettings emits an MCPDeprecationWarning and behaves as False, so existing deployments keep working but are asked to decide; 3.0 makes True the default. An explicit False (the verifier checks the audience itself) is silent. The docs tutorials, the bearer_auth and oauth_client_credentials stories, and the oauth_server snippet now set it to True and issue tokens bound to their resource URL; docs/deprecated.md lists the new warning.
There was a problem hiding this comment.
All reported issues were addressed across 14 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Sorry, something went wrong.
…nippet URL The 3.0 default applies when resource_server_url is set (the field description, warning text, docs and deprecated.md now say so). The oauth_server snippet's resource_server_url matches the address mcp.run() serves on.
| Back | FazBrowse Home | New Git URL |
Adds an opt-in AuthSettings.validate_token_resource. When set, the bearer gate only accepts a token that the TokenVerifier reports as issued for resource_server_url (via AccessToken.resource); a token reporting another resource, or none, gets the same 401 as an unrecognized token. Leaving it unset on a resource server emits an MCPDeprecationWarning and behaves as off; 3.0 makes it the default there.
Motivation and Context
The resource-server gate checks scopes and expiry but has never compared the token's RFC 8707 resource indicator with the server's own identifier; the interaction suite records this as the hosting:auth:aud-validation divergence. In practice that comparison was left to each TokenVerifier, without the docs or the protocol docstring saying so.
This does two things:
The comparison is URL equality with a trailing slash tolerated; both sides go through AnyHttpUrl so host case and an explicit default port don't matter. It lives in BearerAuthBackend (new keyword-only resource_server_url) so a refused token never reaches get_access_token() or custom routes, and a refusal logs both values at warning level.
How Has This Been Tested?
Breaking Changes
None. Unset behaves as off (with the deprecation warning); BearerAuthBackend(verifier) and existing verifiers behave as before. Setting it to True without a resource_server_url raises at construction.
Types of changes
Checklist
Additional context
The docs tutorials, the bearer_auth / oauth_client_credentials stories, the oauth_server snippet and the simple-auth example set the option explicitly and issue tokens bound to their resource URL; docs/deprecated.md lists the warning.
AI Disclaimer