Repository navigation
feat(gateway): a join token is pinned to the first worker that uses it - #894
Merged
Merged
Conversation
Contributor
Author
Review (maintainer's agent, round 1)No blocking findings.
Notes for the maintainer, no change needed in this PR:
|
V3RON
marked this pull request as ready for review
October 26, 2026 09:45
V3RON
added a commit
that referenced
this pull request
Oct 26, 2026
V3RON
force-pushed
the
security/uplink-worker-pin
branch
from
October 26, 2026 10:29
6698566 to
764cc61
Compare
V3RON
added a commit
that referenced
this pull request
Oct 26, 2026
V3RON
force-pushed
the
security/uplink-worker-pin
branch
from
October 26, 2026 10:37
764cc61 to
73552bc
Compare
V3RON
force-pushed
the
security/uplink-worker-pin
branch
from
October 26, 2026 14:25
73552bc to
38c2358
Compare
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.
Summary
A gateway trusted the worker id a dial claimed, and a new uplink under a live id replaced the old link. So one leaked
workerjoin token let anyone take over any worker's link.Now the gateway pins a join token to the first worker id it accepts. Another id on that token, or an id another live token holds, is refused as
worker-mismatch(HTTP 403,worker.rejected). To re-pair:token revoke, thentoken create.Behaviour change: an existing token is pinned to the first worker that reconnects after the upgrade, so workers sharing one token see all but one refused. The docs already said one token per worker.
Changes
src/auth/token-store.ts:worker_idcolumn with a unique index;pinWorkerpins in one transaction, so of two first joins only one wins.authenticateUplink(credential, claimedWorkerId)returnsworker-mismatch; the upgrade answers 403 for it.tokenRecordSchema.workerId, shown bytoken list.PROTOCOL_VERSION_RANGE62 → 63.tokenCLI reference, manuals.Tests
e2e/gateway-fleet.test.ts.Assumptions
tokens.worker_id, so a leaked unused token cannot take over a paired worker; a new token needs the old one revoked first.worker-mismatch.worker.rejectedreasons? — no; the new reason is recorded indocs/internal/EVENTS.mdand the manuals.Review
Spec review: skipped. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: skipped.
Rounds: 1. Tokens: n/a.
One combined review by the maintainer's agent on 2026-10-22 (comment below); no blocking findings.
Rebased onto
maine1f2f43 on 2026-10-26 as one commit. Protocol 62 → 63.tokenRecordSchema.workerIdgets.max(128)with a why comment, which main's wire-bound lint now requires; the uplink already cuts claimed ids to 128 characters.src/gateway/AGENTS.mdkeeps main's shorter known gaps, minus the "claimed id never verified" gap this PR closes.src/auth/AGENTS.mdmerges this PR'sauthenticateUplinkrow with main'stokens.verify.service.test.tsdrops two comments main's comment pass had removed. Main's newe2e/gateway-event-relay.test.tsjoined two workers with one token, which the pin now refuses; it mints one per worker (764cc61).Written by an agent.