Repository navigation
HADOOP-20028. SecurityUtil.getByName rejects bracketed IPv6 literals when token service use_ip is false - #8855
Merged
Merged
Conversation
…when token service use_ip is false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎊 +1 overall
This message was automatically generated. |
Contributor
Contributor
Author
|
Thanks @ayushtkn @jojochuang for the reviews. |
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.
Generated-by: Claude Code (Opus 5.5)
Description of PR
With
hadoop.security.token.service.use_ip=false,SecurityUtil.getByName("[2001:db8::1]")throwsUnknownHostException, while withuse_ip=trueit returns the address.QualifiedHostResolver.resolvedid 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 asDelegationTokenSelector.selectToken(viaNetUtils.createSocketAddrForHost) andNetUtils.getCanonicalUripass that form on.This strips the brackets in
QualifiedHostResolver.resolvewhen 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?
TestSecurityUtil#testGetByNameWithBracketedIPv6: resolves[::1]and[2001:db8::1]withuse_ipfalse and true, and checks that[127.0.0.1]is rejected in both modes. Fails on trunk withUnknownHostException: [::1].TestSecurityUtilandTestNetUtilspass.For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?AI Tooling
Contains content generated by Claude Code.
🤖 Generated with Claude Code