Skip to content

utils: isNonPublicHostname does not judge NAT64, 6to4, Teredo and other special-use IPv6 literals in policy callers #1560

Closed

Description

@nc9

The shared isNonPublicHostname in packages/utils does not judge NAT64 (64:ff9b::/96, 64:ff9b:1::/48), 6to4 (2002::/16), Teredo (2001::/32), site-local, documentation or multicast IPv6 literals. The egress guards are not affected: vetEgressTarget and refusedWithoutLookup branch on isIP(host) first and use public-egress.ts, which has its own embedded-IPv4 logic (checked in the #1547 review with stub resolvers). The gap is in the callers that use the shared function to decide policy, not to refuse a connection:

  • nonPublicHostLabel callers (cloud handoff, render charge and publish gating in apps/cli: cloud.ts, audit.ts, report.ts, mcp/billed-audit.ts) treat such a start URL as public.
  • seed-redirect.ts and smart-audits.ts judge it public, and the skipOnPrivateTarget rule gating in the runner does not skip delivery rules for it.
  • url.ts picks the default scheme from it.

Fixtures in the repo use documentation ranges (192.0.2.x, 203.0.113.x), so widening the shared function would silently change those tests and some rule gating. #1547 added a separate isNonPublicHostnameStrict for the batch urls-file reader for that reason.

Acceptance Criteria

  • The callers that decide cloud handoff, render charge and publish gating treat NAT64, 6to4, Teredo, site-local, documentation and multicast IPv6 literals (and IPv4 special-use ranges) as non-public, or the docs state why they do not
  • seed-redirect.ts, smart-audits.ts and the skipOnPrivateTarget rule gating agree with that decision
  • Tests that rely on documentation-range addresses as "public" are updated or given an explicit option, with the change listed in the PR
  • A test pins that NAT64 and 6to4 literals embedding a private IPv4 are non-public in every policy caller
  • The egress guards' behaviour is unchanged and covered by the existing tests

Activity

  1. added
    bug
    size: S
    rules
    security
    on Nov 2, 2026
  2. added theissue type on Nov 2, 2026
  3. added a commit that references this issue on Nov 14, 2026
    d20f1cf
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

    bugrulessecuritysize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions