Skip to content

Commit 679efbd

Browse files
zeripath6543
authored andcommitted
Disallow urlencoded new lines in git protocol paths if there is a port (go-gitea#13521)
Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 4a71d4d commit 679efbd

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
@@ -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)