[PR #4607] [MERGED] Push whitelist now doesn't apply to branch deletion (#4601) #17431

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

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/4607
Author: @SagePtr
Created: 8/3/2018
Status: Merged
Merged: 8/8/2018
Merged by: @lunny

Base: masterHead: issue4601-master


📝 Commits (4)

  • 3ad569c Push whitelist now doesn't apply to branch deletion (#4601)
  • 813dbf7 Merge branch 'master' into issue4601-master
  • c66be42 Merge branch 'master' into issue4601-master
  • e828002 Merge branch 'master' into issue4601-master

📊 Changes

2 files changed (+20 additions, -2 deletions)

View changed files

📝 models/branches.go (+18 -0)
📝 modules/context/repo.go (+2 -2)

📄 Description

Fixes #4601 (Branch protection does not prevent deletion through the web interface)

Previously, IsProtectedBranch checked if branch is protected and whitelisted for push.

This check applied in almost all operation with protected branch and push whitelist was not 'push' whitelist itself, but whitelist to do whatever, even delete.

Now IsProtectedBranch does what it should do - checks if branch is protected (doesn't care if it's whitelisted or not).

Previous IsProtectedBranch is now IsProtectedBranchForPush - it respects white list and allows push.

This change does not apply to cmd/hook.go because IsProtectedBranch function was not used there, only branch.IsProtected which does whatever it's meant to.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/4607 **Author:** [@SagePtr](https://github.com/SagePtr) **Created:** 8/3/2018 **Status:** ✅ Merged **Merged:** 8/8/2018 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `issue4601-master` --- ### 📝 Commits (4) - [`3ad569c`](https://github.com/go-gitea/gitea/commit/3ad569c1782ca326517baa0346d69c34d21b90df) Push whitelist now doesn't apply to branch deletion (#4601) - [`813dbf7`](https://github.com/go-gitea/gitea/commit/813dbf78cf1d534d48440a62e04f0c94eb03e950) Merge branch 'master' into issue4601-master - [`c66be42`](https://github.com/go-gitea/gitea/commit/c66be42bc943c42bfab6c26506b162a0f77c69fe) Merge branch 'master' into issue4601-master - [`e828002`](https://github.com/go-gitea/gitea/commit/e8280027ba80760ec6a0f567cb59ff6ea52c5699) Merge branch 'master' into issue4601-master ### 📊 Changes **2 files changed** (+20 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `models/branches.go` (+18 -0) 📝 `modules/context/repo.go` (+2 -2) </details> ### 📄 Description Fixes #4601 (Branch protection does not prevent deletion through the web interface) Previously, IsProtectedBranch checked if branch is protected and whitelisted for push. This check applied in almost all operation with protected branch and push whitelist was not 'push' whitelist itself, but whitelist to do whatever, even delete. Now IsProtectedBranch does what it should do - checks if branch is protected (doesn't care if it's whitelisted or not). Previous IsProtectedBranch is now IsProtectedBranchForPush - it respects white list and allows push. This change does not apply to cmd/hook.go because IsProtectedBranch function was not used there, only branch.IsProtected which does whatever it's meant to. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 13:20:46 -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#17431