Skip to content

Commit 9fa4582

Browse files
committed
Truncate and de-newline returnURL
Limit the logged returnURL to just two lines and remove any embedded newlines. Signed-off-by: Kevin Lyda <kevin@lyda.ie>
1 parent 9b5f3e5 commit 9fa4582

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util/oidc/oidc.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
gooidc "github.com/coreos/go-oidc/v3/oidc"
1818
"github.com/golang-jwt/jwt/v4"
1919
log "github.com/sirupsen/logrus"
20+
"github.com/yuin/goldmark/text"
2021
"golang.org/x/oauth2"
2122

2223
"github.com/argoproj/argo-cd/v2/common"
@@ -288,7 +289,8 @@ func (a *ClientApp) HandleLogin(w http.ResponseWriter, r *http.Request) {
288289
returnURL := r.FormValue("return_url")
289290
// Check if return_url is valid, otherwise abort processing (see https://github.com/argoproj/argo-cd/pull/4780)
290291
if !isValidRedirectURL(returnURL, []string{a.settings.URL}) {
291-
log.Errorf("Invalid redirect URL: %s is not a valid per the settings %s.", returnURL, a.settings.URL)
292+
log.Errorf("Invalid redirect URL: %s is not a valid per the settings %s.",
293+
strings.Replace(text.Trunc(returnURL, 160), "\n", "", -1), a.settings.URL)
292294
http.Error(w, "Invalid redirect URL: the protocol and host (including port) must match and the path must be within allowed URLs if provided", http.StatusBadRequest)
293295
return
294296
}

0 commit comments

Comments
 (0)