Skip to content

guard: the four ways out of this program that need no import of net - #51

Merged
donislawdev merged 1 commit into
mainfrom
guard/no-telemetry
Sep 4, 2026
Merged

guard: the four ways out of this program that need no import of net#51
donislawdev merged 1 commit into
mainfrom
guard/no-telemetry

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Asked for by the owner, after a test their sister project wrote (test_no_telemetry.py). This is not a port of it.

That one is Python, where import socket as s defeats a static scan and a PEP 578 audit hook has to make up the difference. Both halves already exist here and are stronger: network_test.go reads our import lines, clinetwork_test.go asks the compiler what the command line binary links, and in Go an import statement carries the real path whatever the file calls it locally - so there is no alias problem to solve.

What neither of them can see

Reaching a network needs no Go networking at all. Four ways, none of which shows up as an import of net:

way out why the existing guards miss it
an address in the code a string is not an import
a library loaded by name internal/gui reaches uxtheme.dll via syscall.NewLazyDLL and calls it by ordinal - wanted, documented, and the same shape that would load wininet.dll
a socket under the import graph syscall is legitimately imported in eight shipped files, so banning it is not available - naming the socket shaped calls is
shelling out curl needs no networking package, and the os/exec ban stops at layer 2 while internal/cli is layer 4 and cmd/tfg is layer 5

Measured: cmd/tfg links os/exec zero times and cmd/tfg-gui once, through the toolkit that opens the support page on a click. So this holds the command line at what it already is, and does not pretend the window is the same sentence - untouchable rule 8 says handing an address to the system browser is not the program connecting to anything.

Scope

Two registries carry the exceptions, each with its reason, each exact in both directions: an unlisted use fails, and a listed one whose code is gone fails too.

The scope is what the compiler says ships (45 packages, so oracle and site are out). Within those it reads every .go file including the ones this system does not build - build.ImportDir honours the build context, so a guard reading only its own platform would let an endpoint into the other one. 158 files.

What it does not prove, said in the file rather than left to be found

A URL assembled at runtime. What a third party module links (a separate sentence, already written). Data leaving without a socket. This is no proof that no traffic leaves the machine - it is a lock on the surface.

It caught a fault in itself first

The first version asked whether a literal started with a scheme, so an address inside a longer string walked through - which is how every XML namespace in this tree is written. Thirteen canary cases missed it, because every one of them put the address on its own. What found it was the staleness half, reporting three registered namespaces as gone. That bug is now a mutation.

Nine mutations, all caught. Full suite green, preflight --quick green on all twelve checks.

🤖 Generated with Claude Code

Asked for by the owner, after a test their sister project wrote. That one is
Python, where an alias defeats a static scan and a PEP 578 audit hook has to
make up the difference. Both of those halves already exist here and are
stronger: network_test.go reads our import lines, clinetwork_test.go asks the
compiler what the command line binary links, and in Go an import statement
carries the real path whatever the file calls it locally - so there is no
alias problem to solve.

What neither of them can see is that reaching a network does not need Go's
networking at all. Four ways, none of which shows up as an import of net:

An address written into the code. A string is not an import.

A library loaded by name. internal/gui reaches uxtheme.dll through
syscall.NewLazyDLL and calls it by ordinal, which is wanted and documented -
and it is the same shape that would load wininet.dll instead.

A socket opened under the import graph. syscall is legitimately imported in
eight shipped files for disk space, signals and the dark menu, so banning it
is not available. Naming the socket shaped calls is.

Shelling out. curl needs no networking package, and the os/exec ban in
network_test.go stops at layer 2 - internal/cli is layer 4 and cmd/tfg is
layer 5, so neither was covered by anything. MEASURED: cmd/tfg links os/exec
zero times and cmd/tfg-gui once, through the toolkit that opens the support
page on a click. This holds the command line at what it already is.

Two registries carry the exceptions, each with its reason, each exact in both
directions - an unlisted use fails and a listed one whose code is gone fails
too. Scope is what the compiler says ships, 45 packages, so oracle and site
are out. Within those it reads every .go file INCLUDING the ones this system
does not build: build.ImportDir honours the build context, so a guard reading
only its own platform would let an endpoint into the other one. 158 files.

The negative result is written down rather than left to be found: this is no
proof that no traffic leaves the machine. It is a lock on the surface.

And it caught a fault in itself before anything else did. The first version
asked whether a literal STARTED with a scheme, so an address inside a longer
string walked through - which is how every XML namespace in this tree is
written. Thirteen canary cases missed it because every one of them put the
address on its own. What found it was the staleness half, reporting three
registered namespaces as gone. That bug is now a mutation.

Nine mutations, all caught.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@donislawdev
donislawdev merged commit 08ac79d into main Sep 4, 2026
18 checks passed
@donislawdev
donislawdev deleted the guard/no-telemetry branch September 4, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant