Skip to content

Commit

Permalink
Disallow urlencoded new lines in git protocol paths if there is a port (
Browse files Browse the repository at this point in the history
go-gitea#13521)

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored and 6543 committed Nov 11, 2020
1 parent 4a71d4d commit 679efbd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/auth/repo_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 679efbd

Please sign in to comment.