You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/03/19 16:43:00 UTC
[jira] [Commented] (YARN-11941) Follow-up to YARN-11937: Improve the yarn.web-proxy.redirect-flag parameter detection in HTTP requests
[ https://issues.apache.org/jira/browse/YARN-11941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18066839#comment-18066839 ]
ASF GitHub Bot commented on YARN-11941:
---------------------------------------
roczei opened a new pull request, #8357:
URL: https://github.com/apache/hadoop/pull/8357
### Description of PR
**Problem Statement**
The fix for YARN-11937 introduced a mechanism to handle yarn_knox_proxy=true (yarn.web-proxy.redirect-flag=yarn_knox_proxy) parameter in the HTTP query. However the current implementation might not correctly identify this parameter when it is part of a larger query string containing multiple parameters. For example in the following URL:
```
...?parameter1=true¶meter2=true&yarn_knox_proxy=true&doAs=user
```
Currently the logic expects the query string to be exactly yarn_knox_proxy=true, it will fail to recognize the flag when other parameters (like doAs, parameter1, or parameter2) are present.
[https://github.com/apache/hadoop/blob/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/ hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java#L555
](https://github.com/apache/hadoop/blob/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java#L555)
```
String redirectFlagName = conf.get(YarnConfiguration.PROXY_REDIRECT_FLAG, "");
if (!redirectFlagName.isBlank() && toFetch.getQuery().equals(redirectFlagName + "=true")) {
ProxyUtils.sendRedirect(req, resp, toFetch.toString());
return;
}
```
**Proposed Change:**
The parameter detection should be improved to properly parse the query string and identify the yarn_knox_proxy=true
key-value pair regardless of its position or the presence of other parameters.
<!--
Thanks for sending a pull request!
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
2. Make sure your PR title starts with JIRA issue id, e.g., 'HADOOP-17799. Your PR title ...'.
-->
### How was this patch tested?
- Updated the testRedirectFlagProxyServlet unit test to cover this scenario as well
- Deployed a cluster with YARN, SPARK, KNOX and checked it there
### For code changes:
- [ ] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
- [ ] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files?
### AI Tooling
If an AI tool was used:
- [ ] The PR includes the phrase "Contains content generated by <tool>"
where <tool> is the name of the AI tool used.
- [ ] My use of AI contributions follows the ASF legal policy
https://www.apache.org/legal/generative-tooling.html
> Follow-up to YARN-11937: Improve the yarn.web-proxy.redirect-flag parameter detection in HTTP requests
> ------------------------------------------------------------------------------------------------------
>
> Key: YARN-11941
> URL: https://issues.apache.org/jira/browse/YARN-11941
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: yarn
> Affects Versions: 3.5.1
> Reporter: Gabor Roczei
> Priority: Major
>
> *Problem Statement*
> The fix for YARN-11937 introduced a mechanism to handle yarn_knox_proxy=true (yarn.web-proxy.redirect-flag=yarn_knox_proxy) parameter in the HTTP query. However the current implementation might not correctly identify this parameter when it is part of a larger query string containing multiple parameters. For example in the following URL:
> {code:java}
> ...?parameter1=true¶meter2=true&yarn_knox_proxy=true&doAs=user{code}
> Currently the logic expects the query string to be exactly yarn_knox_proxy=true, it will fail to recognize the flag when other parameters (like doAs, parameter1, or parameter2) are present.
> [https://github.com/apache/hadoop/blob/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/WebAppProxyServlet.java#L555]
> {code:java}
> String redirectFlagName = conf.get(YarnConfiguration.PROXY_REDIRECT_FLAG, "");
> if (!redirectFlagName.isBlank() && toFetch.getQuery().equals(redirectFlagName + "=true")) {
> ProxyUtils.sendRedirect(req, resp, toFetch.toString());
> return;
> }{code}
> *Proposed Change*
> The parameter detection should be improved to properly parse the query string and identify the yarn_knox_proxy=true key-value pair regardless of its position or the presence of other parameters.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org