Skip to content

Sign aircraft lockout permits from brain to receivers - #182

Merged
devin-ai-integration[bot] merged 5 commits into
mainfrom
feat/signed-lockout-permits
Nov 30, 2026
Merged

devin-ai-integration[bot] merged 5 commits into
mainfrom
feat/signed-lockout-permits

Conversation

@pyramation

@pyramation pyramation commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • 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.


IlluminateSF opened this PR for Dan
Implemented in session Sign aircraft lockout permits from brain to receivers
Review with Devin · Open in Devin Desktop


Summary by CodeRabbit

  • New Features
    • Added challenge-bound, signed aircraft permits with short-lived leases, periodic polling, and immediate revocation.
    • Receivers now limit aircraft output when a valid permit is unavailable, expired, or revoked.
    • Added support for configuring permit signing and verification keys, with rate-limited permit requests.
  • Bug Fixes
    • Prevented permit broadcasts when aircraft data is unavailable or credentials are missing.
    • Improved receiver behavior across reconnects and repeated starts.
  • Documentation
    • Added guidance on permit setup, key handling, blackout behavior, and output limitations.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

Changes: Signed permit flow

Layer / File(s) Summary
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.
Receiver message routing
packages/extensions/src/index.ts, packages/server/src/server.ts
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.
Receiver lease integration
packages/receiver/src/*, packages/receiver/__tests__/*, packages/receiver/package.json
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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 22

  • packages/aircraft-lockout/README.md
  • packages/aircraft-lockout/__tests__/aircraft-lockout.test.ts
  • packages/aircraft-lockout/package.json
  • packages/aircraft-lockout/src/extension.ts
  • packages/extensions/src/index.ts
  • packages/lockout-permits/README.md
  • packages/lockout-permits/__tests__/permits.test.ts
  • packages/lockout-permits/jest.config.js
  • packages/lockout-permits/package.json
  • packages/lockout-permits/src/index.ts
  • packages/lockout-permits/tsconfig.esm.json
  • packages/lockout-permits/tsconfig.json
  • packages/receiver/__tests__/receiver.test.ts
  • packages/receiver/package.json
  • packages/receiver/src/adapters.ts
  • packages/receiver/src/command-types.ts
  • packages/receiver/src/main.ts
  • packages/receiver/src/receiver.ts
  • packages/server/__tests__/aircraft-extension.test.ts
  • packages/server/package.json
  • packages/server/src/brain-extensions.ts
  • packages/server/src/server.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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.

Files selected for processing: 2

  • packages/aircraft-lockout/src/extension.ts
  • packages/server/__tests__/aircraft-extension.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 finding. Devin automatically fixed it.

Fixed by Devin (1)
  • Dropped renewals cause recurring blackouts — Replaced min-interval gate with per-connection token bucket (burst 4, 16/s, derived from renewal interval); jitter test added.

View findings in Devin Review · Follow Devin's work

Devin Review

@devin-ai-integration
devin-ai-integration Bot merged commit 13ae8f7 into main Nov 30, 2026
7 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the feat/signed-lockout-permits branch November 30, 2026 01:09
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.

1 participant