Skip to content

HADOOP-20028. SecurityUtil.getByName rejects bracketed IPv6 literals when token service use_ip is false - #8855

Merged
jojochuang merged 1 commit into
apache:trunkfrom
smengcl:HADOOP-20028
Oct 23, 2026
Merged

jojochuang merged 1 commit into
apache:trunkfrom
smengcl:HADOOP-20028

Conversation

@smengcl

@smengcl smengcl commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

Description of PR

With hadoop.security.token.service.use_ip=false, SecurityUtil.getByName("[2001:db8::1]") throws UnknownHostException, while with use_ip=true it returns the address. QualifiedHostResolver.resolve did not recognize the bracketed form as an IP literal and sent it down the host name and search domain path, where the JDK rejects it.

URI.getHost() returns IPv6 hosts in brackets, so callers such as DelegationTokenSelector.selectToken (via NetUtils.createSocketAddrForHost) and NetUtils.getCanonicalUri pass that form on.

This strips the brackets in QualifiedHostResolver.resolve when the input is a bracketed IPv6 literal (InetAddresses.isUriInetAddress), so both resolvers give the same result. IPv4 addresses and host names are unchanged, and a bracketed IPv4 literal such as [127.0.0.1] is still rejected, as the JDK does.

How was this patch tested?

  • New TestSecurityUtil#testGetByNameWithBracketedIPv6: resolves [::1] and [2001:db8::1] with use_ip false and true, and checks that [127.0.0.1] is rejected in both modes. Fails on trunk with UnknownHostException: [::1].
  • TestSecurityUtil and TestNetUtils pass.

For code changes:

  • Does the title of this PR start 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

Contains content generated by Claude Code.

🤖 Generated with Claude Code

…when token service use_ip is false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 22, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 24s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s 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 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 33m 4s trunk passed
+1 💚 compile 11m 0s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 11m 5s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 55s trunk passed
+1 💚 mvnsite 1m 14s trunk passed
+1 💚 javadoc 0m 53s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 55s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 2m 4s trunk passed
+1 💚 shadedclient 22m 50s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 55s the patch passed
+1 💚 compile 9m 20s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 9m 20s the patch passed
+1 💚 compile 9m 16s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 9m 16s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 45s the patch passed
+1 💚 mvnsite 1m 9s the patch passed
+1 💚 javadoc 0m 47s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 48s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 53s the patch passed
+1 💚 shadedclient 20m 13s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 18m 36s hadoop-common in the patch passed.
+1 💚 asflicense 0m 37s The patch does not generate ASF License warnings.
149m 42s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8855/1/artifact/out/Dockerfile
GITHUB PR #8855
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 300cdbb6b2c6 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 516caa9
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8855/1/testReport/
Max. process+thread count 1276 (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-8855/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.

@ayushtkn ayushtkn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jojochuang
jojochuang merged commit 55263a7 into apache:trunk Oct 23, 2026
6 checks passed
@jojochuang

Copy link
Copy Markdown
Contributor

Merged. Thanks @smengcl @ayushtkn

@smengcl

smengcl commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @ayushtkn @jojochuang for the reviews.

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.

5 participants