gitea/routers/web/auth
Archer 5c542ca94c
Prevent automatic OAuth grants for public clients (#30790)
This commit forces the resource owner (user) to always approve OAuth 2.0
authorization requests if the client is public (e.g. native
applications).

As detailed in [RFC 6749 Section 10.2](https://www.rfc-editor.org/rfc/rfc6749.html#section-10.2),

> The authorization server SHOULD NOT process repeated authorization
requests automatically (without active resource owner interaction)
without authenticating the client or relying on other measures to ensure
that the repeated request comes from the original client and not an
impersonator.

With the implementation prior to this patch, attackers with access to
the redirect URI (e.g., the loopback interface for
`git-credential-oauth`) can get access to the user account without any
user interaction if they can redirect the user to the
`/login/oauth/authorize` endpoint somehow (e.g., with `xdg-open` on
Linux).

Fixes #25061.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-05-02 17:05:59 +00:00
..
2fa.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
auth.go Improve oauth2 client "preferred username field" logic and the error handling (#30622) 2024-04-25 11:22:32 +00:00
auth_test.go Improve oauth2 client "preferred username field" logic and the error handling (#30622) 2024-04-25 11:22:32 +00:00
linkaccount.go Improve oauth2 client "preferred username field" logic and the error handling (#30622) 2024-04-25 11:22:32 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
oauth.go Prevent automatic OAuth grants for public clients (#30790) 2024-05-02 17:05:59 +00:00
oauth_test.go Bump github.com/golang-jwt/jwt to v5 (#25975) 2023-07-19 09:57:10 +00:00
openid.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
password.go Clean up log messages (#30313) 2024-04-07 19:17:06 +08:00
webauthn.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00