logs.gokuls.in

1 pull request merged across 1 repo

bahdotsh/offband

Fixes the findings from a full review of the project. Four of them were reproduced against real SDK services before the fix and re-checked after.

Confirmed bugs

  • A large file from any peer killed the daemon. Our WebSocket frame limit was 8 MiB and the service's is about 134 MiB, so a file over about 6 MiB closed the local API connection and offband up exited. The frame limit now matches the service's, and incoming files over 256 KiB are refused before they are decoded.
  • One malformed message broke the radar for the rest of the run. A peer could send a file envelope with a string body. Unknown kinds now read as chat, file can only come from the SDK's own file events, and the radar view never raises.
  • A cross-site page could drain the agent's inbox. The guard checked X-Offband only on non-GET requests, but reading the inbox consumes it. Every /api/ route now needs the header, except the two read-only event streams.
  • The game route served files outside game/. /game/../game-secret/x passed a string-prefix check. Containment now uses relative_to.

Other fixes

  • A peer can write only under game/, and never on a dot path or an instruction file such as CLAUDE.md, OFFBAND.md, AGENTS.md or GEMINI.md. Anything else, including Makefile, package.json and .claude/settings.json, lands in .offband/received/<sender>/, and the inbox says so.
  • A received file that is not valid base64 is refused, instead of being written as an empty file over the one already there.
  • Names are claims: the first name for an address stands, no peer may use this node's name, and two peers with one name are an error instead of a guess. The inbox now gives each sender's address.
  • Event handlers run on a dispatcher task instead of the socket reader, so a handler that calls the API can no longer deadlock the node.
  • A late joiner with the lowest address waits for the crew it hears of instead of making a second one. A crew merge keeps the newer edit of each task.
  • New --allow ADDRESS limits a node to known peers. New --fresh starts without the previous run's identity, crew and board, and refuses to delete a folder that is not a node home.
  • The service log rotates at 10 MiB. The radar's fonts are bundled, so it no longer loads anything from the internet.
  • websockets>=13, since the code imports websockets.asyncio. The dead game_kit/* package data and the both-sides dial in the spike script are gone.
  • The README security section now describes what is defended, including that anyone in range can join unless --allow is used.

Testing

  • New tests run without the SDK, using a fake local API and a small WebSocket server. The suite now has 79 tests, all passing at every commit.
  • The original reproductions were re-run against the fix on real SDK services over loopback, and all four bugs are gone.
  • Not run over Bluetooth. Every run so far has been loopback on one machine.

Review notes

  • Breaking for a crew that shares files outside game/. Those now arrive in the quarantine instead of in place.
  • Breaking for any client that reads the API without the header. Every /api/ route except the two event streams now needs X-Offband: 1. The radar, the game bridge and the MCP server already send it.
  • Each commit covers one change and passes the suite on its own, so reviewing commit by commit should be easiest.