HADOOP-19904. HttpServer2 access log does not record the authenticated user#8519
Closed
magnuma3 wants to merge 1 commit into
Closed
HADOOP-19904. HttpServer2 access log does not record the authenticated user#8519magnuma3 wants to merge 1 commit into
magnuma3 wants to merge 1 commit into
Conversation
04ad710 to
dd5761e
Compare
…d user Contains content generated by Claude Code
dd5761e to
b60e065
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +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
Install a small Servlet
Filter(in hadoop-common) after theauth filters that:
getRemoteUser()from the wrapped request,Request.setAuthentication(...)on the baseRequestwith a minimal inline
Authentication.User(nojetty-securitydependency).HttpServer2.initializeWebServerinstalls it automatically afterFilterInitializers; no configuration needed. Works for bothKerberos and pseudo-auth — both feed the user through
getRemoteUser().Known gap
DelegationTokenAuthenticationHandler.managementOperationwritesits response inline and returns
false, soAuthenticationFilterskips
filterChain.doFilter. The bridge filter doesn't run fortoken mgmt requests; the handler attaches directly there.
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