fix(api): enforce repository creation token authorization (#39007) (#39014)

Backport #39007 by @bircni

Reject public-only tokens for repository migrations and require
repository scope for canonical organization repository creation. This
aligns both routes with the existing token authorization boundaries.

_Assisted-by: Codex:GPT-5_

Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
Giteabot
2026-08-21 02:44:25 -07:00
committed by GitHub
parent 320b44df58
commit 76c768edca
3 changed files with 58 additions and 3 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ func testOrgCounts(t *testing.T) {
orgOwner := "user2"
orgName := "testOrg"
orgCollaborator := "user4"
ctx := NewAPITestContext(t, orgOwner, "repo1", auth_model.AccessTokenScopeWriteOrganization)
ctx := NewAPITestContext(t, orgOwner, "repo1", auth_model.AccessTokenScopeWriteOrganization, auth_model.AccessTokenScopeWriteRepository)
var ownerCountRepos map[string]int
var collabCountRepos map[string]int