Skip to content

WS3: beacon punch-token gate (default-off)#45

Merged
TeoSlayer merged 6 commits into
mainfrom
feat/dest-carrying-relay-delivery
Jul 23, 2026
Merged

WS3: beacon punch-token gate (default-off)#45
TeoSlayer merged 6 commits into
mainfrom
feat/dest-carrying-relay-delivery

Conversation

@TeoSlayer

Copy link
Copy Markdown
Contributor

Part of pre-launch security remediation (WS3.1). Gates beacon endpoint disclosure behind a target-issued punch token via RequirePunchToken (atomic.Bool, default false — not enforcing, not yet CLI-wired, wire-compatible with old agents). Excludes a junk assertion-less scratch test. Build + punch-token test green.

Note: this branch also carries the previously-committed relay dual-stack fix.

🤖 Generated with Claude Code

teovl and others added 6 commits June 21, 2026 15:15
v0.5.4 adds BeaconMsgDiscoverEx (0x08) and BeaconMsgRelayDeliverDest (0x09)
which this PR references in server.go.
ipv4.PacketConn.WriteBatch (sendmmsg) fails with EINVAL when the send
socket is bound to the IPv6/dual-stack wildcard ([::], the default for a
':port' listen on Linux) and a relay destination carries an IPv4 address.
Because the node fleet is IPv4, this meant every relay delivery to a node
failed and was silently dropped — relay-routed nodes were unreachable.

Detect a dual-stack send socket at worker start and route the flush
through per-packet WriteToUDP (which maps IPv4 destinations onto the
dual-stack socket correctly) instead of the always-failing WriteBatch.
The sendmmsg fast path is unchanged on IPv4-bound sockets, and a
per-packet fallback also covers any unexpected partial-batch error.
Adds RequirePunchToken gate on handlePunchRequest so an endpoint is only
released against a valid target-issued punch token. Gate is an atomic.Bool
defaulting to false (no behavior change; not yet wired to a CLI flag), so this
is wire-compatible and does NOT enforce until explicitly enabled. Adds
zz_punch_token_test.go.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ult off)

Makes the WS3 RequirePunchToken gate flippable in prod. Default false — no
behavior change, wire-compatible with old agents. Enforcement stays deferred.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lay-delivery

# Conflicts:
#	go.mod
#	go.sum
#	server.go
@TeoSlayer
TeoSlayer enabled auto-merge July 23, 2026 22:41
@TeoSlayer
TeoSlayer merged commit efb9948 into main Jul 23, 2026
4 checks passed
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants