Skip to content

Commit 5d932b3

Browse files
authored
Disallow urlencoded new lines in git protocol paths if there is a port (#13521)
Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3fd060e commit 5d932b3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/auth/repo_form.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string, user *models
102102
u.User = url.UserPassword(authUsername, authPassword)
103103
}
104104
remoteAddr = u.String()
105+
if u.Scheme == "git" && u.Port() != "" && (strings.Contains(remoteAddr, "%0d") || strings.Contains(remoteAddr, "%0a")) {
106+
return "", models.ErrInvalidCloneAddr{IsURLError: true}
107+
}
105108
} else if !user.CanImportLocal() {
106109
return "", models.ErrInvalidCloneAddr{IsPermissionDenied: true}
107110
} else if !com.IsDir(remoteAddr) {

0 commit comments

Comments
 (0)