Repository navigation
match redirect authority in http.redirect.allowed.uri check - #3624
rootvector2 wants to merge 1 commit into
Conversation
|
|
||
| String allowedRedirectURI = (String)message.getContextualProperty(AUTO_REDIRECT_ALLOWED_URI); | ||
| if (allowedRedirectURI != null && !newURL.startsWith(allowedRedirectURI)) { | ||
| if (allowedRedirectURI != null && !isAllowedRedirectUri(newUri, newURL, allowedRedirectURI)) { |
There was a problem hiding this comment.
There are 2 properties in play here:
AUTO_REDIRECT_SAME_HOST_ONLY: this one only allow redirects to the same scheme/host and will address your concern I believeAUTO_REDIRECT_ALLOWED_URI: freestyle prefix match (the user could make the prefix as strict as possible)
Hope it makes sense, thank you
There was a problem hiding this comment.
Makes sense. With http.redirect.same.host.only set, the @evil.example and .evil.example redirects are already rejected, and a configured value with a trailing / (e.g. https://api.example.com/) closes it for http.redirect.allowed.uri too. So this is a config concern rather than a bug in the check. Happy to close this, or turn it into a short doc note on the property that the value is a raw prefix match, whichever you prefer.
There was a problem hiding this comment.
I will update docs shortly, seems like we never documented those, the pr could be closed, thanks @rootvector2
There was a problem hiding this comment.
Sounds good, closing this one. A note that http.redirect.allowed.uri is a raw prefix match, so the value should end with /, would cover the case.
There was a problem hiding this comment.
HTTPConduit.checkAllowedRedirectUrienforceshttp.redirect.allowed.uriwith a plainnewURL.startsWith(allowedRedirectURI), so with the allowed valuehttps://api.example.coma server can answer302withLocation: https://api.example.com@evil.example/(orhttps://api.example.com.evil.example/) and the conduit follows it, re-applying the configuredAuthorizationPolicyso Basic credentials are sent to the other host. Found while reviewing the conduit redirect checks, and the newHTTPConduitAllowedRedirectUriTestreproduces it with two local servers. The prefix check now also requires the redirect URI's authority to equal the allowed URI's authority.