0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-14 22:11:32 +01:00
gitea/routers/web/auth
Giteabot 1389fa8a99
Prevent automatic OAuth grants for public clients (#30790) (#30835)
Backport #30790 by archer-321

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: Archer <archer@beezig.eu>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-05-02 20:39:48 +02:00
..
2fa.go Another round of db.DefaultContext refactor (#27103) (#27262) 2023-09-25 19:24:35 +02:00
auth.go Make "/user/login" page redirect if the current user has signed in (#29583) (#29599) 2024-03-05 21:03:45 +08:00
auth_test.go Make "/user/login" page redirect if the current user has signed in (#29583) (#29599) 2024-03-05 21:03:45 +08:00
linkaccount.go Another round of db.DefaultContext refactor (#27103) (#27262) 2023-09-25 19:24:35 +02:00
main_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
oauth.go Prevent automatic OAuth grants for public clients (#30790) (#30835) 2024-05-02 20:39:48 +02:00
oauth_test.go Bump github.com/golang-jwt/jwt to v5 (#25975) 2023-07-19 09:57:10 +00:00
openid.go Reduce usage of db.DefaultContext (#27073) 2023-09-14 17:09:32 +00:00
password.go More refactoring of db.DefaultContext (#27083) 2023-09-15 06:13:19 +00:00
webauthn.go Don't show Link to TOTP if not set up (#27585) (#27588) 2023-10-11 22:59:21 +02:00