forgejo/routers
Gergely Nagy cc80e66153
hooks: Harden when we accept push options that change repo settings
It is possible to change some repo settings (its visibility, and
template status) via `git push` options: `-o repo.private=true`, `-o
repo.template=true`.

Previously, there weren't sufficient permission checks on these, and
anyone who could `git push` to a repository - including via an AGit
workflow! - was able to change either of these settings. To guard
against this, the pre-receive hook will now check if either of these
options are present, and if so, will perform additional permission
checks to ensure that these can only be set by a repository owner or
an administrator. Additionally, changing these settings is disabled for
forks, even for the fork's owner.

There's still a case where the owner of a repository can change the
visibility of it, and it will not propagate to forks (it propagates to
forks when changing the visibility via the API), but that's an
inconsistency, not a security issue.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-04-18 11:53:30 +02:00
..
api Check the token's owner and repository when registering a runner (#30406) (#30412) 2024-04-15 09:35:37 +02:00
common Fix incorrect cookie path for AppSubURL (#29534) (#29552) 2024-03-10 18:45:59 +07:00
install Fix validity of the FROM email address not being checked (#29347) (#29360) 2024-03-06 12:20:42 +08:00
private hooks: Harden when we accept push options that change repo settings 2024-04-18 11:53:30 +02:00
utils Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
web Fix possible renderer security problem(#30136) (#30315) 2024-04-15 11:36:01 +02:00
init.go [API] Forgejo API /api/forgejo/v1 2023-11-13 12:33:48 +01:00