[domistream] Host: HTTP requests, XML answers and pairing #12

Merged
mnovak merged 6 commits from feature/host-pairing-http into main 2026-12-04 12:50:03 +01:00
Owner

Lumen L1, host side of HTTP/HTTPS and pairing: new module host with host::http (strict GET request-head and query parsing, typed routes, XML answer writers) and host::pairing (the host's pairing state machine), tests first.

  • host::http: caps checked before allocation (head 64 KiB, 64 headers, path 256 B, query 40 KiB, 32 params, values 32 KiB); refuses bodies, folded headers, bare CR/LF; routes ServerInfo, AppList, Launch, Resume, Cancel, Pair, Unpair, AppAsset, Unknown; unknown launch parameters kept for logging (U4). Writers for serverinfo (PROTOCOL 1.2, PairStatus only over HTTPS when paired), applist, launch/resume, ok, pair answers, error root; all escaped and checked against what the client parser accepts.
  • host::pairing: the five phases from the host side, holding phase 1 until the owner supplies the PIN (supply_pin, the "Enter the code" box), deadlines from the caller's clock, cancel; phase 5 only over HTTPS with the phase-1 certificate. PairedClient::trusted(cert) records a certificate the owner already trusts (the Tessera-grant path).
  • Lead's decision on the open question: yes, intended. The GameStream handshake key needs the same PIN on both sides, so Arena's own clients (granted through Tessera) do not run /pair against Lumen: arena-host records their client certificate with PairedClient::trusted and hands them the host certificate over the signed grant channel. Arena Domi Remote keeps the PIN path (D5).

Evidence: 52 new tests (our client PairingSession against the host in memory through the real parsers and writers; wrong PIN, bad signatures, every out-of-order phase, wrong client, deadlines, cancel; every client request parses on the host; every host answer parses on the client; hostile heads; caps at max and max+1; proptests). Rebased on PRs #9-#11: 416 passed / 0 failed; clippy, fmt and rustdoc clean. Fuzz: host_http_request 8,784,228 runs / 75 s, host_pairing 45,096 runs / 75 s (RSA signing bound), 0 crashes.

Noted for follow-ups: the client's applist cap allows 4096 apps but its XML element cap allows 4095 (writer caps at 4095); PIN brute force after phase 3 is inherent to the GameStream handshake (matters only against a man in the middle; the Tessera path avoids it).

Clean-room checklist

  • Sources read: none outside this repo (no CLEAN_ROOM row).
  • No forbidden source; no GPL-provenance value.
  • Constants trace to PROTOCOL.md 1.x.
  • Public repo: test keys only, nothing private.

Self-review: rebase conflicts were the lib.rs module table and fuzz bins (merged). Checked that host key material is redacted in Debug, that matches is constant time, and that a fuzzer without a client key can never reach Paired (fuzz invariant). The list of U1/U4/U25/U27 questions is kept for the black-box measurement.

Lumen L1, host side of HTTP/HTTPS and pairing: new module `host` with `host::http` (strict GET request-head and query parsing, typed routes, XML answer writers) and `host::pairing` (the host's pairing state machine), tests first. - `host::http`: caps checked before allocation (head 64 KiB, 64 headers, path 256 B, query 40 KiB, 32 params, values 32 KiB); refuses bodies, folded headers, bare CR/LF; routes ServerInfo, AppList, Launch, Resume, Cancel, Pair, Unpair, AppAsset, Unknown; unknown launch parameters kept for logging (U4). Writers for serverinfo (PROTOCOL 1.2, PairStatus only over HTTPS when paired), applist, launch/resume, ok, pair answers, error root; all escaped and checked against what the client parser accepts. - `host::pairing`: the five phases from the host side, holding phase 1 until the owner supplies the PIN (`supply_pin`, the "Enter the code" box), deadlines from the caller's clock, cancel; phase 5 only over HTTPS with the phase-1 certificate. `PairedClient::trusted(cert)` records a certificate the owner already trusts (the Tessera-grant path). - **Lead's decision on the open question:** yes, intended. The GameStream handshake key needs the same PIN on both sides, so Arena's own clients (granted through Tessera) do not run `/pair` against Lumen: arena-host records their client certificate with `PairedClient::trusted` and hands them the host certificate over the signed grant channel. Arena Domi Remote keeps the PIN path (D5). Evidence: 52 new tests (our client `PairingSession` against the host in memory through the real parsers and writers; wrong PIN, bad signatures, every out-of-order phase, wrong client, deadlines, cancel; every client request parses on the host; every host answer parses on the client; hostile heads; caps at max and max+1; proptests). Rebased on PRs #9-#11: 416 passed / 0 failed; clippy, fmt and rustdoc clean. Fuzz: `host_http_request` 8,784,228 runs / 75 s, `host_pairing` 45,096 runs / 75 s (RSA signing bound), 0 crashes. Noted for follow-ups: the client's applist cap allows 4096 apps but its XML element cap allows 4095 (writer caps at 4095); PIN brute force after phase 3 is inherent to the GameStream handshake (matters only against a man in the middle; the Tessera path avoids it). **Clean-room checklist** - [x] Sources read: none outside this repo (no CLEAN_ROOM row). - [x] No forbidden source; no GPL-provenance value. - [x] Constants trace to PROTOCOL.md 1.x. - [x] Public repo: test keys only, nothing private. **Self-review**: rebase conflicts were the lib.rs module table and fuzz bins (merged). Checked that host key material is redacted in Debug, that `matches` is constant time, and that a fuzzer without a client key can never reach Paired (fuzz invariant). The list of U1/U4/U25/U27 questions is kept for the black-box measurement.
mnovak added 6 commits 2026-12-04 12:49:49 +01:00
mnovak force-pushed feature/host-pairing-http from a65bc54878 to 80047c65df 2026-12-04 12:49:50 +01:00 Compare
mnovak merged commit 337f6a72c5 into main 2026-12-04 12:50:03 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/DomiStream#12