Repository navigation
feat: let resource servers introspect client_credentials tokens - #176
Merged
Merged
Conversation
This was referenced Oct 10, 2026
jaspermayone
marked this pull request as ready for review
October 10, 2026 21:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Quilt is a resource server. Krater calls Quilt with a Weave
client_credentialstoken, and Quilt must check that token. Weave tokens are opaque, so Quilt must usePOST /oauth/introspect. The default Doorkeeper rule lets an app introspect only its own tokens. Thus Quilt gets{"active": false}for every Krater token.What changed
quiltandintrospect. Each has a description inconfig/locales/doorkeeper.en.yml. Discoveryscopes_supportedshows them.scopes_by_grant_type authorization_code:lists only the user scopes. Thus the authorization endpoint givesinvalid_scopefordirectory,quiltandintrospect. These scopes are forclient_credentialstokens only.client_credentialsandrefresh_tokenare not limited.allow_token_introspectionkeeps the Doorkeeper 5.8.2 default rule. It adds one case: the client authenticates with HTTP Basic, its app is allowedintrospect, and the token has no user. A user's token stays private to its own app. A bearer token still introspects only tokens of its own app.introspecton an app (create and update inAdmin::OauthApplicationsController). Any admin can still change the other scopes.docs/OAUTH.mdhas a new "Resource servers" section.Oauth::TokensControlleroverride (AppAccess) does not change.Admin steps after deploy
introspectto the scopes of the Quilt app in/admin/oauth_applications.quiltto the scopes of the Krater app.Tests
spec/requests/oauth/introspection_spec.rb: Quilt introspects a Kraterquilttoken (active,client_id,scope,exp,iat,token_type). Quilt can't see a Krater user token. An app withoutintrospectcan't see another app's token, but still sees its own. Revoked and expired tokens are inactive. A bearer token can't introspect another app's token.quiltis not issued to an app that is not allowed it.directory,quiltandintrospectcan't be asked for at the authorization endpoint.spec/requests/admin_oauth_application_scopes_spec.rb: a plain admin can't add or removeintrospect. A superadmin can.Closes #175