gitea/routers
Giteabot 6d83f5eddc
Prevent automatic OAuth grants for public clients (#30790) (#30836)
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 19:06:32 +00:00
..
api Catch and handle unallowed file type errors in issue attachment API (#30791) (#30834) 2024-05-03 01:45:45 +08:00
common feat(api): implement branch/commit comparison API (#30349) 2024-04-16 11:45:04 +08:00
install Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
private Update misspell to 0.5.1 and add misspellings.csv (#30573) 2024-04-27 08:03:49 +00:00
utils Refactor external URL detection (#29973) 2024-03-22 04:32:40 +08:00
web Prevent automatic OAuth grants for public clients (#30790) (#30836) 2024-05-02 19:06:32 +00:00
init.go Add route handler info for debugging purpose (#30705) 2024-04-26 09:09:49 +00:00