Repository navigation
fix(security): strip CR/LF from response headers, validate redirects, contain uploads (Snyk) - #499
Merged
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- one redirect policy in IdpSSOServlet (drop the second domain check) - RedirectUtility: same origin instead of same host, also the application url; null-safe social.properties reads; strip all control characters (tab) and always set a root-relative Location - check redirect params and the referer raw instead of html-encoded - SamlVerifierServlet follows RelayState only to an allowed destination - uploads: normalize before the containment check and refuse . and .. names - update the filter and SAML tests for root-relative redirects
- containedUploadFile compares Path values, so Windows separators no longer reject every upload - the client file name is reduced to its base name and normalized before the uniqueness check; the reply uses the name actually written - SamlVerifierServlet sends the stored redirect without html-encoding it, so deep links keep their query strings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the Snyk Code rows in Monolith that were waiting on #427, #430 and #429. This branch starts fresh from current
dev; those PRs were read as reference only.WebUtility.responseHeaderValue, strips CR, LF and NUL from redirect, Content-Disposition and Set-Cookie header values in the filters and resources.RedirectUtility.allowedReturnUrlaccepts a relative path, this request's origin, the application URL, the origin of social.propertiesredirect, origins in a new optionalredirect_allowed_origins(comma list), or aWHITE_LIST_DOMAINSdomain. It is applied, as one policy, to the loginredirectparam (request and session, checked raw), the IdpSSOServletredirectparam, the SSOFilter referer and the SAML RelayState redirect.sendLocalRedirectsends root-relative redirects for share-session links and the no-user page, so the host never comes from the request.setAdminnow navigate to relative sibling paths instead of URLs built fromlocation.WebUtility.resolveWithin;.and..names are refused.Behaviour changes
WHITE_LIST_DOMAINSmeant any URL was accepted. Deployments whose UI origin differs from both the Monolith host and social.propertiesredirectneedredirect_allowed_origins. A refused login redirect falls back to the default; a refused IdpSSOServlet redirect returns 403.Testing
/api/config200.https://evil.example.com,//evil.example.comandjavascript:returns 403; relative and same-host values pass.RedirectUtilitywas checked against relative, same-host, configured-origin, host-suffix,//host,/\\host, userinfo and CRLF cases.path=../../xis refused.