feat(federation): admission control on worker registration (S10)

Register() previously trusted a self-declared id and self-chosen token
from any caller, and let a second caller silently hijack an existing
worker id by re-registering it with a different token. Adds an optional
pre-shared AdmitToken (ORCHESTRA_FEDERATION_ADMIT_TOKEN) and requires a
same-id re-registration to present the existing worker's own token.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W1rkJ2hBMybnJctPbcy4tT
This commit is contained in:
kami
2026-07-27 23:34:02 +04:00
parent fab9225a78
commit 8b4955a687
5 changed files with 85 additions and 13 deletions
@@ -80,7 +80,7 @@ func TestCrossMachineLeaseAnchorAndQuotaArePerHost(t *testing.T) {
// worker (spec §2.1): it must be registered and reachable before the
// router would ever consider leasing to it.
workers := &federation.Registry{}
if err := workers.Register(federation.Worker{ID: "workpc", Address: "workpc.mesh", Token: "secret"}); err != nil {
if err := workers.Register(federation.Worker{ID: "workpc", Address: "workpc.mesh", Token: "secret"}, ""); err != nil {
t.Fatal(err)
}
if err := workers.Heartbeat("workpc"); err != nil {