fix(relay): authenticate endpoints and fail closed on missing routes

This commit is contained in:
sagitchu
2026-11-08 23:31:08 +08:00
parent 46bfb86c1b
commit 7f0177491b
50 changed files with 5405 additions and 277 deletions
+57
View File
@@ -0,0 +1,57 @@
# Two-axis review
Fixed base: 3549fe5ad8a6e9b863b3e4f7b9bf738facff87ee plus all task working-tree
changes, including new files. The owner approved this scope and subsequently
authorized PR submission, merge and the next release tag. Initial review was
performed as independent Standards and Spec passes.
## Standards
No new hard violations found against applicable AGENTS.md rules. Repository
access, explicit table names, migrations, response envelopes and agent extension
boundaries comply.
Two non-blocking judgement calls:
1. Possible duplicated code: required_relay_transport_test.go repeats the native
TCP/TLS/KCP fixture in relay_auth_matrix_investigation_test.go. The historical
investigation fixture is deliberately retained separately in this patch, to
preserve the original evidence; helper extraction is deferred.
2. Possible speculative generality: buildFederationServiceConfig accepted a
variadic credential argument but only used its first item. Fixed by accepting
one nullable credential pointer, updating legacy callers explicitly. Focused
generator and federation authentication tests pass.
Summary: zero hard violations; two low-priority smells, one corrected and one
explicitly deferred.
## Spec
Three partial requirements found:
1. Create did not take the lifecycle lock, committing a visible tunnel before
runtime application. Concurrent delete/edit/reconnect could interleave with
stale creation. This violated the create/update/redeploy/delete scope.
2. Federated create held an open database transaction across provider/node
acknowledgments, contrary to the no-network-wait-in-transaction requirement.
3. Offline/timeouts and forward synchronization failures could be swallowed as
success, contrary to the requirement to expose partial application.
These were inherited behaviors within the explicitly promised repair scope,
not regressions introduced by the patch. No additional confirmed auth or
strict-route defect, and no unjustified scope creep found. Explicit legacy,
transport, old-agent and distributed-rollback limits remain documented.
Summary: three lifecycle completion gaps, all assigned for correction before
publication. Follow-up verification will be appended after the fixes.
## Review-driven recovery additions
Follow-up inspection found two additional lifecycle issues during the transaction
and pending-state changes: local port reservations must be published before the
remote acknowledgment wait, and pending updates must still clean obsolete
runtime and reconcile forwards. Both have focused regressions.
A cleanup failure must not discard the removed runtime's ownership. Persistent
cleanup records are being added in the existing database so retries can identify
old endpoints even after desired topology changes. Records are removed only after
acknowledgment and are canceled if current desired topology needs the resource
again. This is targeted cleanup recovery, not distributed transaction rollback.