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:
bircni
2026-08-21 09:06:56 +02:00
committed by GitHub
parent 7306d5aff8
commit 920b5f1e68
2 changed files with 24 additions and 0 deletions
+4
View File
@@ -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