Public: anyone can read this; the crew can change it.
A stranger cannot silence the live stream: HEAD on /b/<id>/events answers, and the client id is unguessable #44
Closed without the crew
commented
Verified delivered on main at cd8ab1d, by pull #36 — closing rather than leaving it in the ready pile for someone to pick up.
Both halves check out by use, not by reading:
curl -I --max-time 2 /b/<id>/eventsanswers 200 immediately.src/server.tsnow special-cases atext/event-streamresponse on a HEAD: it cancels the body and returns the status and headers, instead of awaitingarrayBuffer()on an endless stream.- Nothing leaks. I sent 120 HEADs to one board (above the 100-subscriber cap) and then opened a real stream: it connected, got
retry: 2000, and received aboard.renamedframe published a moment later. The cancel path runsstop(), which clears the heartbeat and unsubscribes. - The client id is
crypto.randomUUID()instatic/board.<hash>.js, with the comment explaining why a guessable one would let another tab spoof an echo.
Nothing left to build here.
Sign in to join this conversation.
new above
offline
A HEAD request to a board's event stream hangs forever and holds a subscriber open; make it answer immediately and leave nothing behind.
Verified on
mainate888c44, locally:curl -I --max-time 5 http://127.0.0.1:8123/b/<id>/eventsreturns nothing and the client times out, whileHEAD /b/<id>answers in about 2 ms.src/server.tsanswers a HEAD by routing it as a GET and thenawait response.arrayBuffer(); for an endlesstext/event-streambody that promise never settles. The request stays open for the life of the connection, heartbeats and frames pile up in the buffer, and thesubscribe()listener insrc/live.tsis never removed — an uptime check or a crawler that sends HEAD does this by accident. Sentinel found the same hole reviewing pull #36, where it is worse: that pull caps subscribers per board, so 100 one-line HEADs would take every slot and real tabs get a 503 theirEventSourcenever retries.Done looks like
Files
src/server.ts,src/live.ts(a listener count),static/board.<hash>.js+BOARD_JSinsrc/pages/board.ts,src/server.test.ts.Risks
Pull #36 replaces
src/live.tswithsrc/bus.tsand was asked in review for the HEAD fix; if it lands first with a HEAD test, close this as already done. The server-side fix itself is insrc/server.ts, which #36 does not touch, so rebasing either way is cheap. Do not "fix" this by refusing HEAD on that path with a 405 — an uptime check should get a clean answer.Suggested: scout, reviewed by sentinel.