Skip to content

utils: follow-ups from the #1561 review (two missing IPv6 ranges, wire-level tests, NAT64 and malformed policy) #1572

Closed

Description

@nc9

Follow-ups from the independent review of #1561 (the policy classifier for non-public hosts, #1560). The PR is accepted; these are not blocking.

Acceptance Criteria

  • isSpecialUseIpv6 includes 100:0:0:1::/64 (RFC 9780 dummy prefix) and 5f00::/16 (SRv6): a 200,000-literal differential against the IANA special-purpose registry shows no other private or special-use IPv6 form returns public.
  • Wire-level tests with a special-use start URL exist for audit.ts (run registration, publish and credit-clamp gate), report --publish and the MCP billed audit; each fails when its call site is switched back to the narrow classifier.
  • The policy for a NAT64 or 6to4 address with a PUBLIC embedded IPv4 (64:ff9b::808:808, 2002:808:808::1) is decided once and documented: today the policy functions judge it non-public (delivery rules skipped, cloud handoff and publish withheld, schemeless default scheme http) while the egress guard treats it as a public destination.
  • The malformed-IPv6 behaviour of the exported policy function is decided and pinned (today any string with a colon that is not a valid IPv6 returns public; callers pass only URL-parsed hosts, so it is unreachable through them).
  • Optional: the anycast and AS112 exceptions inside 2001::/23 (2001:3::, 2001:4:112::, 2001:1::1) and 192.0.0.9 and 192.0.0.10 are not rejected as special-use.
  • The docs say Teredo is 2001::/23 as the code has it (they say 2001::/32).

nik

Activity

  1. added
    size: S
    rules
    security
    on Nov 2, 2026
  2. added theissue type on Nov 2, 2026
  3. nc9 commented on Nov 4, 2026

    @nc9
    ContributorAuthor

    Acceptance check against v0.0.162 (7c31d5b, release). Fix commits: 452a3de and 08aca7d. Tests run on the tag: packages/utils/tests/special-use-ip.test.ts 117 pass, special-use-ipv6-registry.test.ts 5 pass, apps/cli/tests/commands/audit-non-public-host-wiring.test.ts 20 pass, report-publish-non-public-host.test.ts 29 pass, apps/cli/tests/mcp/audit-website-billing.test.ts 29 pass.

    # Criterion Result Evidence
    1 100:0:0:1::/64 and 5f00::/16, 200,000-literal differential PASS special-use-ip.ts isSpecialUseIpv6; special-use-ipv6-registry.test.ts "200,000 random literals inside non-reachable registry blocks never come back public" (seeded) and "the two ranges added by #1572 are covered at their edges"
    2 Wire-level tests for audit.ts, report --publish, MCP billed audit, each failing on the narrow classifier PASS the three CLI test files above carry special-use start URLs (NAT64, 6to4, documentation, site-local, benchmarking), including the credit-clamp gate with a public-host control. I switched each call site to the narrow privateNetworkHostLabel in a scratch worktree: audit-non-public-host-wiring 14 fail, report-publish-non-public-host 7 fail, audit-website-billing 6 fail; restored afterwards
    3 NAT64 and 6to4 with a public embedded IPv4 decided and documented PASS decision: non-public for policy, by prefix; the egress guard judges the embedded address on purpose. Documented in non-public-host.ts and special-use-ip.ts, docs/guides/local-audits-cli.mdx and the CHANGELOG; pinned by "translation prefixes with a public embedded IPv4" in special-use-ip.test.ts
    4 Malformed IPv6 decided and pinned PASS non-public (fail closed), non-public-host.ts; test "a malformed IPv6 is non-public for policy" (the narrow classifier is unchanged)
    5 Optional: anycast and AS112 exceptions in 2001::/23, 192.0.0.9 and 192.0.0.10 PASS isGloballyReachableIetf and the 192.0.0.x carve-out; registry test "the globally reachable carve-outs inside 2001::/23" and "192.0.0.9 and 192.0.0.10 are not special-use"
    6 Docs say Teredo is 2001::/23 PASS docs/guides/local-audits-cli.mdx; no 2001::/32 left in the tree

    All six boxes are ticked. Closing.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    rulessecuritysize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions