]> source.dussan.org Git - gitea.git/commit
fix OIDC introspection authentication (#31632)
authorShivaram Lingamneni <slingamn@cs.stanford.edu>
Tue, 23 Jul 2024 12:43:03 +0000 (14:43 +0200)
committerGitHub <noreply@github.com>
Tue, 23 Jul 2024 12:43:03 +0000 (12:43 +0000)
commit2f1cb1d28918fb19ff21e0a86bc9054a9fb56485
tree3dae79eee17e13ef832bc56cd69ac56900671b7c
parent24f9390f349581e5beb74c54e1f0af1998c8be71
fix OIDC introspection authentication (#31632)

See discussion on #31561 for some background.

The introspect endpoint was using the OIDC token itself for
authentication. This fixes it to use basic authentication with the
client ID and secret instead:

* Applications with a valid client ID and secret should be able to
  successfully introspect an invalid token, receiving a 200 response
  with JSON data that indicates the token is invalid
* Requests with an invalid client ID and secret should not be able
  to introspect, even if the token itself is valid

Unlike #31561 (which just future-proofed the current behavior against
future changes to `DISABLE_QUERY_AUTH_TOKEN`), this is a potential
compatibility break (some introspection requests without valid client
IDs that would previously succeed will now fail). Affected deployments
must begin sending a valid HTTP basic authentication header with their
introspection requests, with the username set to a valid client ID and
the password set to the corresponding client secret.
modules/base/tool.go
modules/base/tool_test.go
routers/web/auth/oauth.go
tests/integration/oauth_test.go