HADOOP-19904. HttpServer2 access log does not record the authenticated user#8521
Open
magnuma3 wants to merge 1 commit into
Open
HADOOP-19904. HttpServer2 access log does not record the authenticated user#8521magnuma3 wants to merge 1 commit into
magnuma3 wants to merge 1 commit into
Conversation
…d user Contains content generated by Claude Code
|
🎊 +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.
Contains content generated by Claude Opus 4.7
Description of PR
HADOOP-19904
Problem
HttpServer2's access log always records
-in the%uposition evenfor authenticated requests:
Affects every HttpServer2-backed daemon (NN/DN/RM/NM/HttpFS/KMS).
Root cause
AuthenticationFilterwrapsHttpServletRequestso downstreamfilters and servlets see the user via
getRemoteUser(). The wraponly flows through the filter chain. Jetty's
RequestLogHandlerruns outside the chain on the base
Request, whosegetAuthentication()stays asNOT_CHECKEDforever.Jetty's native auth path (
jetty-securityAuthenticators) setsRequest.setAuthentication(...)directly, which is why standarddeployments don't have this issue. Hadoop avoids
jetty-securityfor container portability and pays this cost.
Fix
Add a static helper
JettyAuthenticationHelper.publishRemoteUser(...)in hadoop-auth that:
getRemoteUser()or an explicit name),Request.setAuthentication(...)on the baseRequestwitha minimal inline
Authentication.User(nojetty-securitydependency),
Invocation sites cover the paths where the effective user is decided:
AuthenticationFilter.doFilter(filterChain, request, response)—the protected hook called after wrapping. Subclasses
(
ProxyUserAuthenticationFilter,DelegationTokenAuthenticationFilter)wrap with doAs/UGI and route through
super.doFilter, so thissingle hook covers them.
DelegationTokenAuthenticationHandler.managementOperationforGETDELEGATIONTOKEN/RENEW/CANCEL— the handler writes theresponse inline and returns false, skipping the filter chain, so
the helper is called directly there.
JspHelper.getUGIfor HDFS Web UI / WebHDFS servlets that resolveUGI outside the filter chain.
No
HttpServer2configuration changes required; calls are inline ateach path. Works for both Kerberos and pseudo-auth (both feed the
user through
getRemoteUser()/requestUgi).How was this patch tested?
Added unit tests and verified on an internal cluster
For code changes:
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