trails/apps/journal/app
Ullrich Schäfer 7a1dca378f
journal: branded ownership loading for routes and activities
Ownership was checked ad hoc: some handlers loaded-and-compared
ownerId, some lib mutators enforced it in WHERE clauses and silently
no-op'd for non-owners, and nothing tied the two together. Two real
authorization bugs hid in the gaps: linkActivityToRoute ignored its
ownerId parameter entirely (any logged-in user could relink any
activity), and createRouteFromActivity loaded any activity without an
ownership check (a non-owner could copy a private activity's GPX into
their own route). PUT /api/v1/routes/:id also returned ok:true for
non-owners without updating anything.

ownership.server.ts is now the single enforcement point:

- loadOwnedRoute / loadOwnedActivity (non-throwing, for callers with
  their own error vocabulary) and requireOwnedRoute /
  requireOwnedActivity (throwing data() 404/403 for web handlers; 404
  by default so guessed ids don't leak existence)
- the returned entities carry an Owned<> brand; mutators (updateRoute,
  deleteRoute, deleteActivity, updateActivityVisibility,
  linkActivityToRoute, createRouteFromActivity) now require an
  OwnedRef, so skipping the check is a compile error
- vouchOwnership is the explicit, greppable escape hatch for the one
  non-session authorization path (the Planner JWT callback)
- WHERE ownerId clauses stay in the mutators as defense in depth

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 02:35:00 +02:00
..
components fix(journal): show remote followers in follower/following lists 2026-06-07 09:13:44 +02:00
hooks Implement notifications + supporting fixes 2026-04-26 01:28:55 +02:00
jobs journal: typed job seam + Komoot credentials through the manager 2026-06-10 02:05:24 +02:00
lib journal: branded ownership loading for routes and activities 2026-06-10 02:35:00 +02:00
routes journal: branded ownership loading for routes and activities 2026-06-10 02:35:00 +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 fix(journal): remove ineffective dynamic imports 2026-05-24 12:05:08 +02:00
routes.ts feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00