Skip to content

Commit 480efbd

Browse files
6543zeripath
andauthored
Disallow urlencoded new lines in git protocol paths if there is a port (#13521) (#13525)
Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent 4a71d4d commit 480efbd

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
@@ -97,6 +97,9 @@ func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) {
9797
u.User = url.UserPassword(f.AuthUsername, f.AuthPassword)
9898
}
9999
remoteAddr = u.String()
100+
if u.Scheme == "git" && u.Port() != "" && (strings.Contains(remoteAddr, "%0d") || strings.Contains(remoteAddr, "%0a")) {
101+
return "", models.ErrInvalidCloneAddr{IsURLError: true}
102+
}
100103
} else if !user.CanImportLocal() {
101104
return "", models.ErrInvalidCloneAddr{IsPermissionDenied: true}
102105
} else if !com.IsDir(remoteAddr) {

0 commit comments

Comments
 (0)