mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-26 06:43:25 +00:00
fix(api): enforce public-only scope for compare heads (#39006)
Enforce public-only token scope for repositories resolved as compare heads. _Assisted-by: Codex:GPT-5_
This commit is contained in:
@@ -1094,6 +1094,10 @@ func parseCompareInfo(ctx *context.APIContext, compareParam string) (result *git
|
||||
ctx.APIErrorInternal(err)
|
||||
return nil, nil
|
||||
}
|
||||
if !ctx.TokenCanAccessRepo(headRepo) {
|
||||
ctx.APIErrorNotFound()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
isSameRepo := baseRepo.ID == headRepo.ID
|
||||
|
||||
|
||||
Reference in New Issue
Block a user