Repository navigation
fix(http): remove Proxy-Authorization on redirect when the proxy changes - #2256
Conversation
…roxy changes Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
Could you please take a look when you have a chance? This PR brings Kiota Java into parity with the proxy credential scrubbing behavior recently introduced in Kiota .NET (PR #867):
All tests and Spotless formatting checks pass cleanly locally. Thank you! |
…xy auth scrubbing Signed-off-by: Hardik Kaurani <hardikkaurani1@gmail.com>
|
Vincent Biret (@baywet) I have updated the multi-hop redirect test to drive the full A -> B -> A redirect cycle directly through The test now models an initial hop through Proxy A, receives a 302 to Proxy B where intermediate credentials are supplied on the response request, and subsequently redirects back to Proxy A. Using All local tests and Spotless formatting checks pass. Ready for review whenever convenient. |

Summary
When following an HTTP redirect,
RedirectHandlerOption.DEFAULT_SCRUB_SENSITIVE_HEADERSremovesAuthorizationandCookieheaders upon origin changes, and removesProxy-Authorizationwhen no proxy is configured or the proxy is bypassed for the new destination URL.However, if a redirect target is configured with a different proxy than the preceding request, the existing check did not strip
Proxy-Authorization, potentially leaking proxy credentials to an unintended proxy. This pull request ensures thatProxy-Authorizationis removed when the resolved proxy changes across hops, bringing Kiota Java into parity with the RFC 7235 / RFC 9110 credential isolation semantics established in Kiota .NET (PR #867).Changes
RedirectHandlerOption.DEFAULT_SCRUB_SENSITIVE_HEADERS:newUrlwith the proxy resolved fororiginalUrl.Proxy-Authorizationif the proxy becomes inactive (newProxy == null) or changes (!Objects.equals(newProxy, originalProxy)).Proxy-Authorizationwhen the destination routes through the same proxy.RedirectHandlerTests:redirectToUrlWithDifferentProxyStripsProxyAuthreproducing credential stripping when redirecting between distinct proxies.multiHopRedirectBackToOriginalProxyStripsIntermediateProxyAuthvalidating multi-hop isolation so intermediate proxy credentials are never forwarded to subsequent proxies.Validation
./gradlew :components:http:okHttp:spotlessCheck: PASSED./gradlew :components:http:okHttp:test: PASSED (all tests pass)./gradlew test: PASSED (all repository unit tests pass)