Branch protection affects wiki write permission #3642

Closed
opened 2025-11-02 05:20:20 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @maliffi on GitHub (Jul 22, 2019).

  • Gitea version (or commit ref): 1.9.0+rc2-2-g91e24a3a1
  • Git version: 2.22.0
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
2019/07/22 07:48:31 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `repo_id`, `branch_name`, `can_push`, `enable_whitelist`, `whitelist_user_i_ds`, `whitelist_team_i_ds`, `enable_merge_whitelist`, `merge_whitelist_user_i_ds`, `merge_whitelist_team_i_ds`, `approvals_whitelist_user_i_ds`, `approvals_whitelist_team_i_ds`, `required_approvals`, `created_unix`, `updated_unix` FROM `protected_branch` WHERE `repo_id`=? AND `branch_name`=? LIMIT 1 []interface {}{20, "master"}
2019/07/22 07:48:31 ...ters/private/hook.go:107:HookPreReceive() [W] Forbidden: User 23 cannot push to protected branch: master in 824713418768:Integrations/pvf
2019/07/22 07:48:31 models/wiki.go:222:updateWikiPage() [E] exit status 1 - remote: Gitea: protected branch master can not be pushed to
        To /data/git/repositories/integrations/pvf.wiki.git
         ! [remote rejected] 7bd77abfa7580be79b51fa4490fafefc697440d0 -> master (pre-receive hook declined)
        error: failed to push some refs to '/data/git/repositories/integrations/pvf.wiki.git'

2019/07/22 07:48:31 routers/repo/wiki.go:425:EditWikiPost() [E] EditWikiPage: Push: exit status 1 - remote: Gitea: protected branch master can not be pushed to
        To /data/git/repositories/integrations/pvf.wiki.git
         ! [remote rejected] 7bd77abfa7580be79b51fa4490fafefc697440d0 -> master (pre-receive hook declined)
        error: failed to push some refs to '/data/git/repositories/integrations/pvf.wiki.git'

Description

Got error 500 when you try to modify an existing pag einto Wiki or to create a new one.
The problem occurs only if on the default branch (usually "master") has active protection and the user attempting to modify the wiki page does not have permission to push/merge on master.
If the user permissions are modified to allow him to push on master, then he is able to modify/create wiki pages.

Originally created by @maliffi on GitHub (Jul 22, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.0+rc2-2-g91e24a3a1 - Git version: 2.22.0 - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ``` 2019/07/22 07:48:31 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `repo_id`, `branch_name`, `can_push`, `enable_whitelist`, `whitelist_user_i_ds`, `whitelist_team_i_ds`, `enable_merge_whitelist`, `merge_whitelist_user_i_ds`, `merge_whitelist_team_i_ds`, `approvals_whitelist_user_i_ds`, `approvals_whitelist_team_i_ds`, `required_approvals`, `created_unix`, `updated_unix` FROM `protected_branch` WHERE `repo_id`=? AND `branch_name`=? LIMIT 1 []interface {}{20, "master"} 2019/07/22 07:48:31 ...ters/private/hook.go:107:HookPreReceive() [W] Forbidden: User 23 cannot push to protected branch: master in 824713418768:Integrations/pvf 2019/07/22 07:48:31 models/wiki.go:222:updateWikiPage() [E] exit status 1 - remote: Gitea: protected branch master can not be pushed to To /data/git/repositories/integrations/pvf.wiki.git ! [remote rejected] 7bd77abfa7580be79b51fa4490fafefc697440d0 -> master (pre-receive hook declined) error: failed to push some refs to '/data/git/repositories/integrations/pvf.wiki.git' 2019/07/22 07:48:31 routers/repo/wiki.go:425:EditWikiPost() [E] EditWikiPage: Push: exit status 1 - remote: Gitea: protected branch master can not be pushed to To /data/git/repositories/integrations/pvf.wiki.git ! [remote rejected] 7bd77abfa7580be79b51fa4490fafefc697440d0 -> master (pre-receive hook declined) error: failed to push some refs to '/data/git/repositories/integrations/pvf.wiki.git' ``` ## Description Got error 500 when you try to modify an existing pag einto Wiki or to create a new one. The problem occurs only if on the default branch (usually "master") has active protection and the user attempting to modify the wiki page does not have permission to push/merge on master. If the user permissions are modified to allow him to push on master, then he is able to modify/create wiki pages.
GiteaMirror added the type/bug label 2025-11-02 05:20:20 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3642