Repository navigation
fix(net): refuse 100.64.0.0/10 and IPv4 wrapped in IPv6 (NAT64, IPv4-compatible) - #2620
Merged
Merged
Conversation
…compatible) validateIP and the restricted-mode net_allow check used net.IP.IsPrivate, which covers RFC 1918 and fc00::/7 only. 100.64.0.0/10 (CGNAT, Tailscale) passed, and an IPv4 address inside 64:ff9b::/96, 64:ff9b:1::/48 or ::/96 was judged as public IPv6. One shared classifier (net_ipclass.go) now unwraps the embedded IPv4 address and refuses 100.64/10 and 0.0.0.0/8 as well; both sites use it. A public IPv4 address wrapped in NAT64 stays allowed. Tests extend the end-to-end no-dial tables (resolved and literal forms) and add classifier unit tests with positive controls. Mutation-tested: each of the four parts of the fix, removed alone, fails at least one test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sunholo-voight-kampff
added a commit
that referenced
this pull request
Dec 2, 2026
TestPremiseSweep_CorpusTokenOffsets failed on Windows CI (PR #2620) with GetFileAttributesEx on a .artifacts-*.tmp under examples/intra_package_imports/.ailang/cache: another package's test was compiling that example concurrently and the temp file vanished between the directory read and the stat. The walk now never enters .ailang (a compile cache, not corpus source) and ignores an entry that no longer exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
Netdestination checks (validateIP) and the restricted-modenet_allowconfig check used Go'sIsPrivate, which covers RFC 1918 and fc00::/7 only:64:ff9b::/96and64:ff9b:1::/48, or IPv4-compatible::a.b.c.d) was judged as public IPv6; a NAT64 gateway translates64:ff9b::a00:1to10.0.0.1.Reported by Daneel, 2026-11-29 (two inbox messages).
Fix
One shared classifier,
internal/effects/net_ipclass.go:EffectiveIPunwraps embedded IPv4, thenIsSharedAddressSpaceandIsThisNetwork(0.0.0.0/8) join the existing rules. Both sites (effects.validateIP,policy.checkNetAllowEntry) call it. An audit found no other site that judges whether an address is private (IsPrivate/IsLinkLocalUnicastappear only in these two). A public address wrapped in NAT64 (64:ff9b::808:808) is still allowed.Tests
::ffff:100.64.0.1, NAT64 private/loopback/metadata, IPv4-compatible, 0.0.0.0/8.TestEffectiveIP_UnwrapsEmbeddedIPv4,TestValidateIP_NonPublicForms, with positive controls: 100.63.255.255, 100.128.0.0, NAT64 of 8.8.8.8, public IPv6.TestResolve_NetAllowEntriesgains 6 refused entries.Gates:
go test ./internal/effects ./internal/policy,make lint,check-file-sizes,check-changelog,check-boundaries.For v1.0.0-rc.4.
🤖 Generated with Claude Code