Two related issues in the token public-only scope enforcement introduced by PR #32204 (CVE-2025-68941 fix). A public-only scoped API token can access private organization data.
routers/api/v1/api.go line 1599:
m.Get("/user/orgs", reqToken(), tokenRequiresScopes(
auth_model.AccessTokenScopeCategoryUser,
auth_model.AccessTokenScopeCategoryOrganization,
), org.ListMyOrgs)
// Missing checkTokenPublicOnly()
Adjacent route at line 1603 has it:
m.Group("/users/{username}/orgs", func() { ... },
..., checkTokenPublicOnly())
routers/api/v1/api.go lines 253-295. Go switch executes only the first matching case. For routes with categories [User, Organization]:
curl -H "Authorization: token <PUBLIC_ONLY_TOKEN>" https://gitea.example.com/api/v1/user/orgsExpected: only public organizations returned.
Public-only scoped tokens can enumerate private organizations the token owner belongs to. Violates the token's declared scope constraints.
checkTokenPublicOnly() to /user/orgs route at line 1599Current main branch, commit 2c2d7e6 (April 3, 2026).
{
"github_reviewed": true,
"github_reviewed_at": "2026-06-16T23:41:31Z",
"nvd_published_at": null,
"severity": "MODERATE",
"cwe_ids": [
"CWE-862"
]
}