Skip to content

Commit 122f8f8

Browse files
6543zeripath
andauthored
Disallow urlencoded new lines in git protocol paths if there is a port (go-gitea#13521) (go-gitea#13524)
Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
1 parent 1f72656 commit 122f8f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/auth/repo_form.go

+3
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)