fix(live): a phrase is four plain words and a tail, and nothing weaker

Two holes in the one credential a stream has.

The wordlist has four hyphenated entries (`drop-down`, `felt-tip`,
`t-shirt`, `yo-yo`). A phrase drawn from one is six tokens --
`abacus-drop-down-lantern-harbor-7k2qp` -- and a listener cannot hear where
the tail starts. `words()` now keeps only `^[a-z]+$`; 7772 words costs
0.003 bits, so the ~77.5-bit figure is unchanged. The shape test asserted
over 50 draws, which caught this about a tenth of the time; the property is
now asserted over the whole list.

`validate` accepted `a-b-c`. It is what an operator-supplied `--phrase` is
checked against, so everything it accepts is a password someone can choose
for a LAN-facing stream. The floor is now exactly what `generate` produces:
four `[a-z]{3,}` words and a five-character `[a-z0-9]` tail. The router
still looks phrases up without validating, so an unknown phrase is the same
empty 404 it was.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01URhyHGQnmKH9zBXxoznfQY
This commit is contained in:
HermenixandClaude Opus 5 committed 2026-10-06 16:19:41 +00:00
1 parent 52e3786bfb
commit 19338af17c
3 files changed
+97 -28

No files matched your search

+13 -7
View File
@@ -85,14 +85,20 @@ session record so it survives a broker restart and a re-enable.
- Shape: `<word>-<word>-<word>-<word>-<xxxxx>`, e.g.
`amber-otter-lantern-harbor-7k2qp`.
- Words come from a **vendored EFF large wordlist** (7776 words, ~70 KB, in the
- Words come from a **vendored EFF large wordlist** (7776 lines, ~70 KB, in the
repo — no network at runtime, no dependency) and the tail is five characters
of `[a-z0-9]`. Four words is `4 · log2(7776) ≈ 51.7` bits and the tail adds
`5 · log2(36) ≈ 25.8`, for **≈ 77.5 bits** — comfortably past anything a LAN
request rate can enumerate, and the operator's stated shape ("5 with a random
5 character string for the last word").
- `--phrase` on enable sets your own (checked against the shape); `disable`
then `enable` **rotates** it. A rotation is one record write.
of `[a-z0-9]`. Four of those lines are hyphenated (`drop-down`, `felt-tip`,
`t-shirt`, `yo-yo`) and are dropped on load, because a hyphen is the phrase's
own separator and such a word would make a six-token phrase nobody could hear
the shape of; **7772 words** are usable. Four words is `4 · log2(7772) ≈ 51.7`
bits and the tail adds `5 · log2(36) ≈ 25.8`, for **≈ 77.5 bits** —
comfortably past anything a LAN request rate can enumerate, and the operator's
stated shape ("5 with a random 5 character string for the last word").
- `--phrase` on enable sets your own, and it is held to **exactly the generated
shape** (four `[a-z]{3,}` words plus a five-character `[a-z0-9]` tail): the
phrase is the stream's only credential, so anything a `--phrase` may be is a
password an operator can choose, and a looser check would accept `a-b-c`.
`disable` then `enable` **rotates** it. A rotation is one record write.
- The phrase is the only credential. It is in the URL, in cleartext on the LAN
when the LAN is opted into — the threat model is "another device on the LAN
can watch if it can guess the phrase", not "the phrase is hidden from the