YARN: restrict web proxy redirects to the application host - #8701
Open
nishat-06 wants to merge 1 commit into
Open
YARN: restrict web proxy redirects to the application host#8701nishat-06 wants to merge 1 commit into
nishat-06 wants to merge 1 commit into
Conversation
|
💔 -1 overall
This message was automatically generated. |
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.
Description of PR
WebAppProxyServlet.proxyLinkfetches an application's tracking URL server-side with an HttpClient that auto-follows redirects, and that tracking URL is whatever the application master registered. A malicious AM can answer the proxied request with a redirect tohttp://169.254.169.254/(cloud metadata), a loopback admin port, or another internal cluster service, and the proxy follows it and streams the response back to the viewing user, which is a server-side request forgery. This restricts the follow to the application's own host: aSameHostRedirectStrategyrejects any redirect whose host differs from the tracking URL host, so a same-host application UI redirect still works while a cross-host hop is refused.Trigger before the change: AM registers a tracking URL, the proxied
GETreturns302 Location: http://169.254.169.254/latest/meta-data/, and the proxy fetches the metadata endpoint from inside the cluster and returns the body. After the change that redirect is not followed and the fetch fails like any other unreachable target.How was this patch tested?
Added
testProxyRedirectToDifferentHostIsRefusedwhich drives the strategy with a same-hostLocation(followed) and a169.254.169.254Location(refused withProtocolException), and ran thehadoop-yarn-server-web-proxymodule tests. ThetestAppReportForEmptyTrackingUrlfailure seen locally is unrelated and reproduces on a clean tree (this host has no resolvable hostname).For code changes:
declared according to the connector-specific documentation? Note: Automated CI
testing doesn't cover all cases so manual testing with cloud storage is still
required.
LICENSE,LICENSE-binary,NOTICE-binaryfiles?AI Tooling
If an AI tool was used:
where is the name of the AI tool used.
https://www.apache.org/legal/generative-tooling.html