Fleet TLS-only transport, piece 2: communicator-esp32 enforcement #17

Merged
troed merged 6 commits from feat/fleet-tls-piece-2-esp32 into devel 2026-10-14 11:32:08 +02:00
Owner

What

Piece 2 of the fleet TLS-only transport design: make the ESP32 firmware's realtime transport unconditionally TLS, so no build path can silently put the protocol on the wire unencrypted or without trust material.

  • Trust material is compiler-required. main/ota_trust.h's tracked placeholder is now an #error (no empty CA can ever compile), and main/CMakeLists.txt regenerates the header at configure time: production keys (tools/ota-keys/) when present, otherwise the shared dev set with a DEV TRUST MATERIAL banner.
  • No TLS opt-out. CONFIG_WS_TLS is deleted; main/ws_client.c always builds wss:// with .transport = WEBSOCKET_TRANSPORT_OVER_SSL and the pinned CA.
  • covers() reads the leaf's real SANs instead of trusting the MANIFEST (the piece-1 review's suggestion).
  • tools/release_firmware.sh refuses dev-trust firmware (replaces the old CONFIG_WS_TLS=y assertion).
  • Docs (README/AGENTS) state the always-TLS transport and required material.
  • Static invariant fence (host/tests/test_tls_invariant.py) pins the source-level properties, complementing the build gate.

Why

All three fleet repos shared one defect: TLS material optional, absence silently degrading to plaintext ws://. On 2026-10-14 the attached ESP32 joined its network, got an IP, then died at the WebSocket upgrade because the flashed build spoke plaintext into a wss:// listener (closed with zero bytes — indistinguishable from a dead wake word).

  • Design: starfleet:docs/superpowers/specs/2026-10-14-fleet-tls-only-design.md
  • Plan: starfleet:docs/superpowers/plans/2026-10-14-fleet-tls-piece-2-esp32-enforcement.md

Verification

  • Host suite: 157 passed, 1 deselected (the deselected test is the pre-existing environmental failure that shells out to a host-built venv).
  • Sandbox idf.py builds, all three trust paths exercised and state restored:
    • production keys present → production material embedded, no banner (RF3);
    • no production keys → dev material + DEV TRUST MATERIAL banner, dev set at <workspace>/.dev-trust;
    • no keys + empty CONFIG_SERVER_HOST → configure prints the remedy and the build fails at the placeholder #error (RF1).
  • Fresh code review (independent reviewer, no Critical; 2 Important fixed in one RED→GREEN pass: committed-header fence + provenance-aware regeneration, and honouring the build's SDKCONFIG).

Not in this PR

  • Task 6, the on-hardware dev-trust run, is deferred: it needs the attached unit, host actions, a server running with the dev leaf, and a human to hear the reply.
  • computer and communicator-sailfish enforcement (pieces 3 and 4).
  • One deferred doc minor: AGENTS.md's server-side live-tap example still uses ws://127.0.0.1 (a computer-side script; piece 3).
## What Piece 2 of the fleet TLS-only transport design: make the ESP32 firmware's realtime transport **unconditionally TLS**, so no build path can silently put the protocol on the wire unencrypted or without trust material. - **Trust material is compiler-required.** `main/ota_trust.h`'s tracked placeholder is now an `#error` (no empty CA can ever compile), and `main/CMakeLists.txt` regenerates the header at configure time: production keys (`tools/ota-keys/`) when present, otherwise the shared dev set with a `DEV TRUST MATERIAL` banner. - **No TLS opt-out.** `CONFIG_WS_TLS` is deleted; `main/ws_client.c` always builds `wss://` with `.transport = WEBSOCKET_TRANSPORT_OVER_SSL` and the pinned CA. - **`covers()` reads the leaf's real SANs** instead of trusting the `MANIFEST` (the piece-1 review's suggestion). - **`tools/release_firmware.sh` refuses dev-trust firmware** (replaces the old `CONFIG_WS_TLS=y` assertion). - **Docs** (README/AGENTS) state the always-TLS transport and required material. - **Static invariant fence** (`host/tests/test_tls_invariant.py`) pins the source-level properties, complementing the build gate. ## Why All three fleet repos shared one defect: TLS material optional, absence silently degrading to plaintext `ws://`. On 2026-10-14 the attached ESP32 joined its network, got an IP, then died at the WebSocket upgrade because the flashed build spoke plaintext into a `wss://` listener (closed with zero bytes — indistinguishable from a dead wake word). - Design: `starfleet:docs/superpowers/specs/2026-10-14-fleet-tls-only-design.md` - Plan: `starfleet:docs/superpowers/plans/2026-10-14-fleet-tls-piece-2-esp32-enforcement.md` ## Verification - Host suite: **157 passed, 1 deselected** (the deselected test is the pre-existing environmental failure that shells out to a host-built venv). - Sandbox `idf.py` builds, all three trust paths exercised and state restored: - production keys present → production material embedded, no banner (RF3); - no production keys → dev material + `DEV TRUST MATERIAL` banner, dev set at `<workspace>/.dev-trust`; - no keys + empty `CONFIG_SERVER_HOST` → configure prints the remedy and the build **fails at the placeholder `#error`** (RF1). - Fresh code review (independent reviewer, no Critical; 2 Important fixed in one RED→GREEN pass: committed-header fence + provenance-aware regeneration, and honouring the build's `SDKCONFIG`). ## Not in this PR - **Task 6, the on-hardware dev-trust run**, is deferred: it needs the attached unit, host actions, a server running with the dev leaf, and a human to hear the reply. - `computer` and `communicator-sailfish` enforcement (pieces 3 and 4). - One deferred doc minor: `AGENTS.md`'s server-side live-tap example still uses `ws://127.0.0.1` (a `computer`-side script; piece 3).
troed merged commit 2ae13fff0c into devel 2026-10-14 11:32:08 +02:00
troed deleted branch feat/fleet-tls-piece-2-esp32 2026-10-14 11:32:08 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starfleet/communicator-esp32!17
No description provided.