Fix non-admins unable to automerge PRs from forks#36833
Merged
wxiaoguang merged 5 commits intogo-gitea:mainfrom Mar 6, 2026
Merged
Fix non-admins unable to automerge PRs from forks#36833wxiaoguang merged 5 commits intogo-gitea:mainfrom
wxiaoguang merged 5 commits intogo-gitea:mainfrom
Conversation
Contributor
|
If admin user (user1) wasn't used for testing, the bug should have been caught by existing tests in early days ..... |
lunny
approved these changes
Mar 5, 2026
wxiaoguang
approved these changes
Mar 5, 2026
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 6, 2026
* giteaofficial/main: Fix non-admins unable to automerge PRs from forks (go-gitea#36833) upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (go-gitea#36837) Fix dump release asset bug (go-gitea#36799) build(deps): update material-icon-theme v5.32.0 (go-gitea#36832) Fix bug to check whether user can update pull request branch or rebase branch (go-gitea#36465) Fix forwarded proto handling for public URL detection (go-gitea#36810) Fix artifacts v4 backend upload problems (go-gitea#36805) Add a git grep search timeout (go-gitea#36809) fix(repo): unify DEFAULT_SHOW_FULL_NAME output in templates and dropdown (go-gitea#36597) Harden render iframe open-link handling (go-gitea#36811)
Collaborator
|
I was unable to create a backport for 1.25. @Enzime, please send one manually. 🍵 |
lunny
added a commit
to lunny/gitea
that referenced
this pull request
Mar 6, 2026
Make `handlePullRequestAutoMerge` correctly check the permissions of the merging user against pr.BaseRepo. --------- Co-authored-by: Michael Hoang <enzime@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
silverwind
added a commit
to silverwind/gitea
that referenced
this pull request
Mar 6, 2026
* origin/main: (27 commits) Fix OAuth2 authorization code expiry and reuse handling (go-gitea#36797) Fix org permission API visibility checks for hidden members and private orgs (go-gitea#36798) Fix non-admins unable to automerge PRs from forks (go-gitea#36833) upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (go-gitea#36837) Fix dump release asset bug (go-gitea#36799) build(deps): update material-icon-theme v5.32.0 (go-gitea#36832) Fix bug to check whether user can update pull request branch or rebase branch (go-gitea#36465) Fix forwarded proto handling for public URL detection (go-gitea#36810) Fix artifacts v4 backend upload problems (go-gitea#36805) Add a git grep search timeout (go-gitea#36809) fix(repo): unify DEFAULT_SHOW_FULL_NAME output in templates and dropdown (go-gitea#36597) Harden render iframe open-link handling (go-gitea#36811) [skip ci] Updated translations via Crowdin fix: /repos/{owner}/{repo}/actions/{runs,jobs} requiring owner permissions (go-gitea#36818) Fix CRAN package version validation to allow more than 4 version components (go-gitea#36813) Fix API not persisting pull request unit config when has_pull_requests is not set (go-gitea#36718) feat: Add Actions API rerun endpoints for runs and jobs (go-gitea#36768) Fix bug when pushing mirror with wiki (go-gitea#36795) Pull Request Pusher should be the author of the merge (go-gitea#36581) Delete non-exist branch should return 404 (go-gitea#36694) ... # Conflicts: # routers/web/repo/issue_view.go
silverwind
added a commit
to silverwind/gitea
that referenced
this pull request
Mar 6, 2026
* main: Fix dbfs error handling (go-gitea#36844) Fix OAuth2 authorization code expiry and reuse handling (go-gitea#36797) Fix org permission API visibility checks for hidden members and private orgs (go-gitea#36798) Fix non-admins unable to automerge PRs from forks (go-gitea#36833) upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (go-gitea#36837) # Conflicts: # go.mod # go.sum
silverwind
pushed a commit
that referenced
this pull request
Mar 8, 2026
backport #36833 Make `handlePullRequestAutoMerge` correctly check the permissions of the merging user against pr.BaseRepo. Co-authored-by: Michael Hoang <10492681+Enzime@users.noreply.github.com> Co-authored-by: Michael Hoang <enzime@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
silverwind
added a commit
to silverwind/gitea
that referenced
this pull request
Mar 8, 2026
* main: (26 commits) Clean up `refreshViewedFilesSummary` (go-gitea#36868) Remove `util.URLJoin` and replace all callers with direct path concatenation (go-gitea#36867) Optimize Docker build with dependency layer caching (go-gitea#36864) Fix URLJoin, markup render link reoslving, sign-in/up/linkaccount page common data (go-gitea#36861) Fix CodeQL code scanning alerts (go-gitea#36858) Refactor auth middleware (go-gitea#36848) Update Nix flake (go-gitea#36857) Update JS deps (go-gitea#36850) Load `mentionValues` asynchronously (go-gitea#36739) [skip ci] Updated translations via Crowdin Fix dbfs error handling (go-gitea#36844) Fix OAuth2 authorization code expiry and reuse handling (go-gitea#36797) Fix org permission API visibility checks for hidden members and private orgs (go-gitea#36798) Fix non-admins unable to automerge PRs from forks (go-gitea#36833) upgrade to github.com/cloudflare/circl 1.6.3, svgo 4.0.1, markdownlint-cli 0.48.0 (go-gitea#36837) Fix dump release asset bug (go-gitea#36799) build(deps): update material-icon-theme v5.32.0 (go-gitea#36832) Fix bug to check whether user can update pull request branch or rebase branch (go-gitea#36465) Fix forwarded proto handling for public URL detection (go-gitea#36810) Fix artifacts v4 backend upload problems (go-gitea#36805) ... # Conflicts: # pnpm-lock.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a user with write access to a repo (but not a site admin) tries to automerge a PR from a fork they don't have write access to, the automerge fails with the following error in the logs:
I believe this occurs because
handlePullRequestAutoMergechecks the permissions of the merging user against the fork (pr.HeadRepo) instead of against the destination repo (pr.BaseRepo).I used Opus 4.6 to debug this issue, write the fix and the regression test. I've manually tested this fix on my own Gitea instance and I've tested that the regression test correctly fails without the fix and succeeds with the fix :)