diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 6c3421e4f7..c51adadba1 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -97,6 +97,9 @@ func (f MigrateRepoForm) ParseRemoteAddr(user *models.User) (string, error) { u.User = url.UserPassword(f.AuthUsername, f.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) {