test(ipv6): assert a compressed address at the maximum colon count is valid - #1102
Open
vtushar06 wants to merge 1 commit into
Open
test(ipv6): assert a compressed address at the maximum colon count is valid#1102vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
jviotti
approved these changes
Aug 12, 2026
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.
The third
IPv6addressalternative in RFC 3986 Section 3.2.2 isWith the optional prefix absent and
ls32 = h16 ":" h16, that is::1:2:3:4:5:6. The alternative has no valid test in the current file.@exodus/schemasafe 1.3.0 rejects it, while passing all 40 tests the file has today. Its
ipv6checker is a hand-written character scan rather than a regex, and it ends with (src/formats.js):s0is the colon count,s1the dot count, andshortis true when a::was seen.spacesis the colon count of an uncompressed address: seven for eight groups, six for six groups plus a dotted quad. The compressed branch on the last line reuses that same number, but an elision adds a colon to the string. The real maxima are 8 and 7, so every compressed address sitting at the top of its colon range is rejected:::1:2:3:4:5:61:2:3:4:5:6:7::1::2:3:4:5:6:71:2:3:4:5::1.2.3.41:2:3:4:5::::ffff:192.168.0.1The file's nine compressed valid cases -
::1,::abef,::,::42:ff:1,d6::,1:d6::42,1::d6:192.168.0.1,1:2::192.168.0.1,::ffff:192.168.0.1- all sit at six colons or fewer, which is why none of them reaches this.I picked the seven-colon pure-hex form as the representative because it also fills the missing third alternative.
1:2:3:4:5:6:7::fails the same way but is a shape the file already covers throughd6::.Changes
One test, added to the six files where
format: ipv6exists:::1:2:3:4:5:6- validEcosystem Impact
RFC References
IPv6addressABNF, third alternative.::elision.