Skip to content

HADOOP-19904. HttpServer2 access log does not record the authenticated user#8519

Closed
magnuma3 wants to merge 1 commit into
apache:trunkfrom
magnuma3:httpserver2-access-log-user
Closed

HADOOP-19904. HttpServer2 access log does not record the authenticated user#8519
magnuma3 wants to merge 1 commit into
apache:trunkfrom
magnuma3:httpserver2-access-log-user

Conversation

@magnuma3
Copy link
Copy Markdown

@magnuma3 magnuma3 commented May 27, 2026

Contains content generated by Claude Opus 4.7

Description of PR

HADOOP-19904

Problem

HttpServer2's access log always records - in the %u position even
for authenticated requests:
Affects every HttpServer2-backed daemon (NN/DN/RM/NM/HttpFS/KMS).

Root cause

AuthenticationFilter wraps HttpServletRequest so downstream
filters and servlets see the user via getRemoteUser(). The wrap
only flows through the filter chain. Jetty's RequestLogHandler
runs outside the chain on the base Request, whose
getAuthentication() stays as NOT_CHECKED forever.

Jetty's native auth path (jetty-security Authenticators) sets
Request.setAuthentication(...) directly, which is why standard
deployments don't have this issue. Hadoop avoids jetty-security
for container portability and pays this cost.

Fix

Install a small Servlet Filter (in hadoop-common) after the
auth filters that:

  1. Reads getRemoteUser() from the wrapped request,
  2. Calls Request.setAuthentication(...) on the base Request
    with a minimal inline Authentication.User (no
    jetty-security dependency).

HttpServer2.initializeWebServer installs it automatically after
FilterInitializers; no configuration needed. Works for both
Kerberos and pseudo-auth — both feed the user through
getRemoteUser().

Known gap

DelegationTokenAuthenticationHandler.managementOperation writes
its response inline and returns false, so AuthenticationFilter
skips filterChain.doFilter. The bridge filter doesn't run for
token mgmt requests; the handler attaches directly there.

How was this patch tested?

Added unit tests and verified on an internal cluster

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?
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files?

AI Tooling

If an AI tool was used:

@magnuma3 magnuma3 force-pushed the httpserver2-access-log-user branch from 04ad710 to dd5761e Compare May 27, 2026 04:03
@magnuma3 magnuma3 changed the title HDFS-17928. HttpServer2 access log does not record the authenticated user HADOOP-19904. HttpServer2 access log does not record the authenticated user May 27, 2026
…d user

Contains content generated by Claude Code
@magnuma3 magnuma3 force-pushed the httpserver2-access-log-user branch from dd5761e to b60e065 Compare May 27, 2026 04:11
@magnuma3 magnuma3 closed this May 27, 2026
@hadoop-yetus
Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 33s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 43m 24s trunk passed
+1 💚 compile 17m 53s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 18m 24s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 27s trunk passed
+1 💚 mvnsite 1m 57s trunk passed
+1 💚 javadoc 1m 21s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 18s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 16s trunk passed
+1 💚 shadedclient 31m 20s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 12s the patch passed
+1 💚 compile 17m 2s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 17m 2s the patch passed
+1 💚 compile 17m 57s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 17m 57s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 21s the patch passed
+1 💚 mvnsite 1m 51s the patch passed
+1 💚 javadoc 1m 21s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 21s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 19s the patch passed
+1 💚 shadedclient 31m 33s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 23m 26s hadoop-common in the patch passed.
+1 💚 asflicense 1m 10s The patch does not generate ASF License warnings.
223m 11s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/2/artifact/out/Dockerfile
GITHUB PR #8519
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux d66ebd0b865e 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / dd5761e
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/2/testReport/
Max. process+thread count 3061 (vs. ulimit of 10000)
modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/2/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 37s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 44m 6s trunk passed
+1 💚 compile 18m 21s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 17m 57s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 26s trunk passed
+1 💚 mvnsite 1m 59s trunk passed
+1 💚 javadoc 1m 19s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 17s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 14s trunk passed
+1 💚 shadedclient 32m 17s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 16s the patch passed
+1 💚 compile 17m 9s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 17m 9s the patch passed
+1 💚 compile 18m 1s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 18m 1s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 19s the patch passed
+1 💚 mvnsite 1m 58s the patch passed
+1 💚 javadoc 1m 22s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 20s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 26s the patch passed
+1 💚 shadedclient 31m 57s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 23m 43s hadoop-common in the patch passed.
+1 💚 asflicense 1m 13s The patch does not generate ASF License warnings.
226m 3s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/1/artifact/out/Dockerfile
GITHUB PR #8519
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux e277720f1949 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / dd5761e
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/1/testReport/
Max. process+thread count 1321 (vs. ulimit of 10000)
modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/1/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 12m 35s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 2 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 44m 21s trunk passed
+1 💚 compile 16m 0s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 16m 39s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 30s trunk passed
+1 💚 mvnsite 1m 58s trunk passed
+1 💚 javadoc 1m 31s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 26s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 9s trunk passed
+1 💚 shadedclient 30m 45s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 13s the patch passed
+1 💚 compile 15m 18s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 15m 18s the patch passed
+1 💚 compile 16m 25s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 16m 25s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 26s the patch passed
+1 💚 mvnsite 1m 56s the patch passed
+1 💚 javadoc 1m 29s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 27s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 19s the patch passed
+1 💚 shadedclient 31m 23s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 22m 55s hadoop-common in the patch passed.
+1 💚 asflicense 1m 14s The patch does not generate ASF License warnings.
229m 2s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/3/artifact/out/Dockerfile
GITHUB PR #8519
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 2a3ff9d568cc 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b60e065
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/3/testReport/
Max. process+thread count 1398 (vs. ulimit of 10000)
modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8519/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants