Repositories owned by private users and organisations and pulls by restricted users need to have permissions checked. Previously Serv would simply assumed that if the user could log in and the repository was not private then it would be visible. Fix #17364 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>release/v1.15
parent
79a3d277e5
commit
79f0b1a50b
|
@ -278,7 +278,12 @@ func ServCommand(ctx *context.PrivateContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Permissions checking:
|
// Permissions checking:
|
||||||
if repoExist && (mode > models.AccessModeRead || repo.IsPrivate || setting.Service.RequireSignInView) {
|
if repoExist &&
|
||||||
|
(mode > models.AccessModeRead ||
|
||||||
|
repo.IsPrivate ||
|
||||||
|
owner.Visibility.IsPrivate() ||
|
||||||
|
user.IsRestricted ||
|
||||||
|
setting.Service.RequireSignInView) {
|
||||||
if key.Type == models.KeyTypeDeploy {
|
if key.Type == models.KeyTypeDeploy {
|
||||||
if deployKey.Mode < mode {
|
if deployKey.Mode < mode {
|
||||||
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
|
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{
|
||||||
|
|
Loading…
Reference in New Issue