diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bec1cf7f6..429b00ec2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ If you are using an architecture specific tag (ex: v7.2.1-arm64) you should move - [#1286](https://github.com/oauth2-proxy/oauth2-proxy/pull/1286) Add the `allowed_email_domains` and the `allowed_groups` on the `auth_request` + support standard wildcard char for validation with sub-domain and email-domain. (@w3st3ry @armandpicard) - [#1361](https://github.com/oauth2-proxy/oauth2-proxy/pull/1541) PKCE Code Challenge Support - RFC-7636 (@braunsonm) - [#1594](https://github.com/oauth2-proxy/oauth2-proxy/pull/1594) Release ARMv8 docker images (@braunsonm) +- [#1649](https://github.com/oauth2-proxy/oauth2-proxy/pull/1649) Return a 400 instead of a 500 when a request contains an invalid redirect target (@niksko) - [#1638](https://github.com/oauth2-proxy/oauth2-proxy/pull/1638) Implement configurable upstream timeout (@jacksgt) # V7.2.1 diff --git a/oauthproxy.go b/oauthproxy.go index a571fcab1d..cd2a331153 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -714,7 +714,7 @@ func (p *OAuthProxy) doOAuthStart(rw http.ResponseWriter, req *http.Request, ove appRedirect, err := p.appDirector.GetRedirect(req) if err != nil { logger.Errorf("Error obtaining application redirect: %v", err) - p.ErrorPage(rw, req, http.StatusInternalServerError, err.Error()) + p.ErrorPage(rw, req, http.StatusBadRequest, err.Error()) return } diff --git a/oauthproxy_test.go b/oauthproxy_test.go index 25d23b450d..218b4426c4 100644 --- a/oauthproxy_test.go +++ b/oauthproxy_test.go @@ -678,6 +678,17 @@ func TestSignInPageIncludesTargetRedirect(t *testing.T) { } } +func TestSignInPageInvalidQueryStringReturnsBadRequest(t *testing.T) { + sipTest, err := NewSignInPageTest(true) + if err != nil { + t.Fatal(err) + } + const endpoint = "/?q=%va" + + code, _ := sipTest.GetEndpoint(endpoint) + assert.Equal(t, 400, code) +} + func TestSignInPageDirectAccessRedirectsToRoot(t *testing.T) { sipTest, err := NewSignInPageTest(false) if err != nil {