You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sign aircraft lockout permits from brain to receivers - #182
Follow-up to #180. Lockout permits were unauthenticated, so any host on the network could forge one and reopen a blacked-out receiver unless the link ran over wss. Receivers now accept only permits signed by their brain.
New workspace package packages/lockout-permits: Ed25519 signing/verification (node:crypto) plus a single-use challenge lease. The brain holds the private key file; every receiver (and every shard) pins the brain's public key.
Permits are receiver-initiated: each receiver/shard sends a challenge every 250 ms, the brain replies with a signed permit only to the requesting socket. The lease clock starts when the request is sent, so delayed or replayed replies can't extend it; an invalid reply revokes the active lease.
Fail closed: missing key, bad signature, wrong key, stale/replayed reply or no reply → output stays dark (existing lease expires at most 1.5 s after the request).
Deny is still immediate: on lockout the brain pushes an unsigned revoke. It can only close output, never open it, so it needs no signature; receivers black out and drop any in-flight request.
Operator status broadcasts are unchanged. The aircraft lockout guide documents key generation and placement.
Tests cover tampering, wrong/missing keys, delayed and replayed replies, reconnects, sharding, socket scoping, push revoke and in-flight rejection. Not verified on hardware.
Permit protocol and lease packages/lockout-permits/*
The new package defines permit request and decision shapes, Ed25519 signing and verification, and a lease that checks challenges and expires permits relative to request-send time. Tests cover signature validation, lease expiry, reset behavior, and renewal overlap.
The extension host collects responses for eligible receiver messages. The server sends those responses to the requesting client.
Brain permit issuance and revocation packages/aircraft-lockout/*, packages/server/src/brain-extensions.ts, packages/server/__tests__/aircraft-extension.test.ts, packages/server/package.json
The aircraft extension validates and rate-limits permit requests, returns a signed permit when conditions and signing are available, and publishes revocations when status becomes inhibited. The server loads the signer. Tests and documentation cover key provisioning, signed responses, and revocation.
The receiver loads a verifier, polls with lease-generated requests, handles permit and revoke messages, and resets lease state on connection, disconnection, and stop. Tests cover invalid permits, reconnects, polling, and revocation.
Possibly related PRs
constructive-io/wavegrid#180: Adds the aircraft proximity lockout that this change extends with signed, challenge-bound permits.
Suggested reviewers:luxor-code-review
Change: Feature
Merge Risk: Minimal · up to 0a955 · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Security architecture risk: Moderate · up to 0a955
Signed permits make it harder to reopen protected output with a forged message. The tradeoffs are operational: upgrading or rolling back only one side leaves affected receivers dark, and the new signing workload is limited per connection rather than across the brain.
Retained concerns
Minor · reliability · observed: Upgrading or rolling back only one side interrupts permit renewal for protected receivers. The new brain no longer pushes legacy grants, and the new receiver rejects unsigned legacy grants. Affected receivers or shards stay dark after any outstanding lease expires.
Minor · security · inferred: The PR adds synchronous signing work reachable by peers admitted with the existing receiver credential. The budget limits each connection independently, so total signing work grows with admitted connections. Under sufficient load, the shared brain could miss legitimate renewals and leave protected receivers dark. This is an availability concern, not a way to bypass the aircraft policy.
Security review details
Security Blast Radius
inferred — Signing load is shared by receivers served by the same brain. The reviewed path establishes a per-connection limit, not a deployment-wide bound or an impact across independent brains. A mixed-version or mismatched-key cutover affects the protected receivers and shards that cannot renew.
Security Findings and Attack Paths
observed — The network trust tradeoff for denial predates this PR: the base accepted unsigned deny messages, and the head still accepts an unsigned revoke on the connected input. The head revoke only removes permission; it cannot reopen output.
Trust Boundaries and Controls
observed — The existing receiver credential gates admission to the request path. The extension host excludes scoped and operator peers, and an admitted receiver can request a decision but cannot override the brain’s local policy check.
observed — The receiver verifies against its pinned key, accepts only a pending challenge for its policy, and consumes that challenge and older pending requests. An invalid permit clears the current lease, and a delayed reply cannot move expiry beyond the deadline computed from the original request.
Resilience and Maintainability Implications
observed — When the brain detects a transition into inhibit, it pushes a revoke without waiting for a renewal. If the revoke is not delivered, the receiver stops authorizing normal output when the lease expires, at most 1.5 seconds after the associated request.
Hardening Proposals
proposed — Set a brain-wide signing budget alongside the per-connection budget, and validate that the brain can serve renewals for the intended shard count under peak supported load.
proposed — Document a coordinated upgrade and rollback window, verify key provisioning for each shard before cutover, and make clear that rolling back both sides restores unsigned permits.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Architecture findings (2)
Advisory architecture findings (2)
Minor — The new request path lets a holder of the brain’s shared receiver credential drive synchronous policy evaluation and, while policy allows, signing. The limiter is per connection, not per credential or brain. Unlike the previous periodic grant path, aggregate permit work now scales with requesting connections. If that work delays the shared brain, healthy receivers and shards can miss renewals and black out. Existing authentication narrows reachability; no service saturation was demonstrated.
Minor — Neither mixed-version pairing can renew protected output: old brains do not answer signed-protocol requests, and old receivers do not request permits from new brains. Keys are loaded at startup, so replacing only one side of a key pair also prevents renewal. A one-sided upgrade, rollback, or rotation can therefore leave affected receivers or shards dark until the versions and keys match. This is a fail-closed availability break, not evidence of an output bypass.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: e216ebe9-5759-42dc-97b4-308903378bf7
Commits
Reviewing files that changed from the base of the PR and between e79ef81 and 119491e.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Architecture findings (2)
Advisory architecture findings (2)
Minor — Upgrading or rolling back only one side interrupts permit renewal for protected receivers. The new brain no longer pushes legacy grants, and the new receiver rejects unsigned legacy grants. Affected receivers or shards stay dark after any outstanding lease expires.
Minor — The PR adds synchronous signing work reachable by peers admitted with the existing receiver credential. The budget limits each connection independently, so total signing work grows with admitted connections. Under sufficient load, the shared brain could miss legitimate renewals and leave protected receivers dark. This is an availability concern, not a way to bypass the aircraft policy.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: b5786d72-e466-45f6-a826-30d9332938a8
Commits
Reviewing files that changed from the base of the PR and between 119491e and 0a955e8.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
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
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
Follow-up to #180. Lockout permits were unauthenticated, so any host on the network could forge one and reopen a blacked-out receiver unless the link ran over wss. Receivers now accept only permits signed by their brain.
packages/lockout-permits: Ed25519 signing/verification (node:crypto) plus a single-use challenge lease. The brain holds the private key file; every receiver (and every shard) pins the brain's public key.Tests cover tampering, wrong/missing keys, delayed and replayed replies, reconnects, sharding, socket scoping, push revoke and in-flight rejection. Not verified on hardware.
Implemented in session Sign aircraft lockout permits from brain to receivers
Review with Devin · Open in Devin Desktop
Summary by CodeRabbit