Browse Source

Disallow urlencoded new lines in git protocol paths if there is a port (#13521)

Signed-off-by: Andrew Thornton <art27@cantab.net>
tags/v1.15.0-dev
zeripath GitHub 4 years ago
parent
commit
b64f394eba
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      modules/auth/repo_form.go

+ 3
- 0
modules/auth/repo_form.go View File

@@ -102,6 +102,9 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string, user *models
u.User = url.UserPassword(authUsername, authPassword)
}
remoteAddr = u.String()
if u.Scheme == "git" && u.Port() != "" && (strings.Contains(remoteAddr, "%0d") || strings.Contains(remoteAddr, "%0a")) {
return "", models.ErrInvalidCloneAddr{IsURLError: true}
}
} else if !user.CanImportLocal() {
return "", models.ErrInvalidCloneAddr{IsPermissionDenied: true}
} else if !com.IsDir(remoteAddr) {


Loading…
Cancel
Save