Skip to content

Commit 79f0b1a

Browse files
6543zeripath
andauthored
Ensure correct SSH permissions check for private and restricted users (#17370) (#17373)
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 <[email protected]> Co-authored-by: Andrew Thornton <[email protected]>
1 parent 79a3d27 commit 79f0b1a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

routers/private/serv.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,12 @@ func ServCommand(ctx *context.PrivateContext) {
278278
}
279279

280280
// Permissions checking:
281-
if repoExist && (mode > models.AccessModeRead || repo.IsPrivate || setting.Service.RequireSignInView) {
281+
if repoExist &&
282+
(mode > models.AccessModeRead ||
283+
repo.IsPrivate ||
284+
owner.Visibility.IsPrivate() ||
285+
user.IsRestricted ||
286+
setting.Service.RequireSignInView) {
282287
if key.Type == models.KeyTypeDeploy {
283288
if deployKey.Mode < mode {
284289
ctx.JSON(http.StatusUnauthorized, private.ErrServCommand{

0 commit comments

Comments
 (0)