trails/apps/planner/app
Ullrich Schäfer 6f2b4450df
fix(planner/brouter): cap upstream response size to 10MB
Planner-audit #9. \`fetchSegment\` previously \`await response.json()\`
on any body BRouter returned. A misbehaving or compromised upstream
could OOM the planner process by returning gigabytes of JSON.

New \`readBodyWithCap()\`:
- Reject upfront when \`content-length\` declares over the cap.
- Stream the body and abort the reader once received bytes exceed
  the cap (handles the case where upstream lies about content-length
  or omits it).

Cap chosen at 10 MB — real per-segment GeoJSON is <100 KB; even the
longest realistic multi-day route stays well under 2 MB. Above 10 MB
is upstream bug or abuse; we'd rather error.

Applied to both \`fetchSegment\` (GeoJSON path) and \`computeSegmentGpx\`
(GPX path).

Tests: 3 cases (within cap, content-length over cap, streamed body
mid-cap abort).
2026-05-26 00:48:45 +02:00
..
components fix(planner): keep journal callback token off the client (#2 Phase A) 2026-05-26 00:29:24 +02:00
jobs Add pg-boss background job queue with session expiry 2026-04-13 21:17:24 +02:00
lib fix(planner/brouter): cap upstream response size to 10MB 2026-05-26 00:48:45 +02:00
routes fix(planner): keep journal callback token off the client (#2 Phase A) 2026-05-26 00:29:24 +02:00
entry.client.tsx Add legal pages, ToS acceptance, and alpha banner 2026-04-18 00:08:48 +02:00
entry.server.tsx Consolidate Sentry config into shared package; fix inconsistencies 2026-04-18 00:30:09 +02:00
root.tsx Disable page zoom on iOS to prevent accidental pinch-to-zoom 2026-04-12 19:35:56 +02:00
routes.ts fix(planner): keep journal callback token off the client (#2 Phase A) 2026-05-26 00:29:24 +02:00