net: fix BlockList.fromJSON for IPv4-mapped IPv6 rules by watilde · Pull Request #64125 · nodejs/node · GitHub
Skip to content

net: fix BlockList.fromJSON for IPv4-mapped IPv6 rules#64125

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:fix/blocklist-fromjson-ipv4-mapped-ipv6
Open

net: fix BlockList.fromJSON for IPv4-mapped IPv6 rules#64125
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:fix/blocklist-fromjson-ipv4-mapped-ipv6

Conversation

@watilde

@watilde watilde commented Jun 25, 2026

Copy link
Copy Markdown
Member

BlockList.toJSON() serializes IPv4-mapped IPv6 addresses in mixed dotted-quad form (e.g. "::ffff:192.0.2.128"), but the fromJSON() rule parser's IPv6 regexes excluded "." and capped the length at 39, so such rules were silently corrupted or dropped on a toJSON()/fromJSON() round-trip. Allow "." and raise the cap to 45 (the longest mixed form).

BlockList.toJSON() serializes IPv4-mapped IPv6 addresses in mixed
dotted-quad form (e.g. "::ffff:192.0.2.128"), but the fromJSON() rule
parser's IPv6 regexes excluded "." and capped the length at 39, so such
rules were silently corrupted or dropped on a toJSON()/fromJSON()
round-trip. Allow "." and raise the cap to 45 (the longest mixed form).

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants