Fix a bug when forking a repository in an organization#36950
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an organization permission check to the fork API flow so users without CanCreateOrgRepo cannot fork a repository into an organization.
Changes:
- Add integration test asserting forking into an org is forbidden when the user lacks org repo-create permission.
- Enforce
CanCreateOrgRepocheck in the API fork endpoint before selecting the org as the forker.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/integration/api_fork_test.go | Adds coverage for forking into an org when the caller lacks create-repo permission. |
| routers/api/v1/repo/fork.go | Adds org repo-create permission gating before allowing forks into an organization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Zettat123
approved these changes
Apr 1, 2026
wxiaoguang
reviewed
Apr 2, 2026
Contributor
|
Cleaned up AI slop. HasOrgOrUserVisible was missing |
wxiaoguang
approved these changes
Apr 2, 2026
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Apr 3, 2026
* main: Fix RPM Registry 404 when package name contains 'package' (go-gitea#37087) Improve actions notifier for `workflow_run` (go-gitea#37088) Refactor code render and render control chars (go-gitea#37078) Fix various problems (go-gitea#37077) [skip ci] Updated translations via Crowdin Support legacy run/job index-based URLs and refactor migration 326 (go-gitea#37008) Fix a bug when forking a repository in an organization (go-gitea#36950)
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.
CanCreateOrgReposhould be checked before forking a repository into this organization.Generated by a coding agent with Codex 5.2