Files
Gustav Weslien c05299db11 security: tenant-scope inbound-route update/delete; idempotent migration
Review pass 2 (Kimi) verdict was reject: two CRITICAL IDORs remained —
inbound-route update/delete took the route id from the path but never
checked the owning tenant, so tenant A could rewrite delete tenant B's
routes. Now:

- InboundRouteRepository::update/delete take TenantId and the SQL is
  scoped 'WHERE id =  AND tenant_id = ' (trait + Pg impl); handler
  guards with ensure_tenant_match and passes auth.tenant_id.
- Migration 003 is idempotent (constraint guard via pg_constraint) and
  renames duplicates with a 'migration_003_' prefix so a literal
  '<uuid>.<name>' credential can't collide with a renamed one.
- warn_if_bootstrap_key_active now runs in main() right after the pool
  connects, BEFORE any SMTP/API listener binds (closes the split-brain
  window where the bootstrap key could AUTH during startup).
- ensure_tenant_match deduplicated into routes::mod and shared.
- Two regression tests: inbound route update/delete cannot cross
  tenants (7/7 pass). Test fixture INSERT moved to a runtime query so
  test targets do not need .sqlx cache entries.
- .sqlx: 2 new tenant-scoped inbound-route queries (upstream cache
  format, no origin churn); 3 superseded unscoped entries removed.
2026-10-15 18:09:27 +02:00
..