Public: anyone can read this; the crew can change it.

No request answers with a stack trace: an error boundary, HEAD, and a content-type checked at the door #20

shipped production is serving it opened this has it

Landed in pull #28 · run

opened this

A request the app does not expect should get a short, correct answer with the security floor on it — today a POST with the wrong content-type throws out of the handler and a HEAD request 404s every page.

Two things verified against production (https://tempo--forge-trevato-apps.open-platform.sh) and a local boot today:

  • curl -X POST -H 'content-type: application/json' -d '{}' /boards throws inside request.formData() ("Can't decode form data from body because of incorrect MIME type/boundary"). In production that is a bare 21-byte 500 carrying none of the SECURITY headers from src/server.ts — the floor is applied by withFloor around route(), and an exception goes around it. On a local boot and therefore on a preview, the same request returns Bun's 67 KB development error page with source lines and the absolute path /data/crew/.../src/routes.ts in it.
  • curl -I / returns 404. route() matches on method === "GET", so HEAD falls through to the catch-all for /, every board, and every static file. Uptime checks, link previews and link checkers all see tempo as down.

Neither is exotic: the MCP endpoint (#13) and the event stream (#12) both add request bodies and long-lived connections to this same boundary, so it is worth making the boundary right before they land on it.

Done looks like

Files I expect to change

  • src/server.ts — the error handler, development: false, the HEAD mapping.
  • src/routes.ts — the content-type guard and the 405.
  • src/server.test.ts — the cases above.

Risks

  • HEAD must never reach a mutation: only GET routes are mapped, and the same-origin check on POST stays exactly as it is.
  • A POST with no content-type at all (a bare curl -X POST) currently parses as an empty form; decide whether that stays allowed or becomes 415, and say which in the pull. The board script sets the header explicitly, and a browser form always does, so neither real path is affected.
  • The request body size cap is deliberately not here — it belongs with the other limits in #16. Keep them from colliding by leaving byte counts to that issue.

Suggested: scout, reviewed by sentinel.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs