0022: A household password and a LAN page, held by the runner
Status: Superseded in part by 0031 (the password). Proposed (my call, 2026-11-16). The LAN page, its lockout, its sessions and the wizard's first-run purpose stand; the password and its words went.
Context
Pairing and the store must work without a TV (owner, 2026-11-16: pairing "should still support ways to pair without a TV screen"). A phone or laptop on the LAN needs a page, and a page open to the LAN needs a login. Options: a password the web page holds itself; a password the runner holds, with the page as a thin face; a first-come "set a password" form; no password.
Decision
The household has one password: three common words from a fixed list of about 2,000 (the EFF short list, 33 bits; case and spaces ignored when typed, so a phone keyboard cannot get it wrong), made by the runner and shown on the first-run wizard. The wizard opens on whichever home is first while it is due, the TV's or a paired device's (a household may have no TV; owner, 2026-11-18), and closes on every home once one finishes it. The runner keeps it as a scrypt hash in household.json on its state volume (0600), with a secret that signs 30-day sessions; a new password makes a new secret, so every session ends. The web service (port 8970, plain HTTP, no Docker socket) asks the runner to check logins and sessions. Cookies are HttpOnly and SameSite=Strict; five wrong logins from one address lock it for a minute (a try counts from when it is sent, so tries sent at once cannot slip past). The page answers only to an IP address, localhost or a name in WEB_URL/WEB_HOSTS, so a website cannot reach it through DNS rebinding. A host with no password gets none from the page (a first-come form would be won by anyone on the LAN): ./couchdogs password sets one from a host shell, writing the file the runner reads.
Consequences
- The password crosses the LAN in plain HTTP, like Moonlight's own pairing. A self-signed certificate would make every phone warn. Known limit.
- The lockout keys on the client address. If Docker's port publishing hides client addresses (every request then comes from the bridge gateway), all clients share one lockout.
- The runner runs at most two password checks (16 MiB each) at once, whatever asks, so a burst of logins cannot push it past its memory cap.
- A household that opens the page by a local name (
couch.lan) must put it inWEB_HOSTSorWEB_URL. - Three words are guessable by a determined attacker with LAN access; the lockout only slows one address.
- Signed-in LAN users can send a pairing PIN, so they can pair a device for the household.
- A restart of
webkeeps sessions (they are signed, the secret is the runner's). A new password signs everyone out. - One source of truth: the TV, the LAN page and the host command all go through the runner's file.
- A paired device's home can run the wizard and set a new password with no login, like the TV: pairing already made it the household's.