fix(nameserver): reject structurally invalid IPv6 address literals - #2869
Open
yyqdbngt wants to merge 1 commit into
Open
fix(nameserver): reject structurally invalid IPv6 address literals#2869yyqdbngt wants to merge 1 commit into
yyqdbngt wants to merge 1 commit into
Conversation
RockteMQ-AI
approved these changes
Aug 31, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Solid fix — the old validation only checked character set + colon count, so [1:2:3] was incorrectly accepted. Using InetAddress.getByName after the character pre-filter is safe (no DNS risk) and provides full structural validation. Good regression tests.
LGTM.
Automated review by github-manager-bot
RockteMQ-AI
approved these changes
Sep 1, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Defensive fix that improves input validation and error handling. Code looks clean and follows existing patterns.
LGTM
Automated review by "github-manager-bot"
RockteMQ-AI
approved these changes
Sep 1, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM — defensive fix improving input validation and error handling.
Automated review by "github-manager-bot"
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.
Summary
NamesrvAddrParser.isValidIpv6Literalnow performs a full address-literal parse(
InetAddress.getByName, after the existing character-set pre-filter that preventsany DNS lookup) in addition to the character/colon checks.
[1:2:3],[ffff:0]) arerejected, and full-form literals are accepted and lowercased.
Why
The old check only validated the character set and required at least two colons, so
[1:2:3]— three groups, not a valid IPv6 address — was accepted into the registryand only failed much later when the probe connected through the RocketMQ client. The
pre-filtered character set guarantees
getByNametreats the value as a literal (nohostname, no DNS), so the parse adds full structural validation without the
unbounded-resolution risk the parser was designed to avoid.
Testing
cd server && mvn -Dtest=NamesrvAddrParserTest test— Tests run: 17, Failures: 0, Errors: 0cd server && mvn -Dtest=NameserverRegistryServiceTest,NameServerControllerTest test— Tests run: 36, Failures: 0, Errors: 0