feat(auth): migrate rmm + time_tracking to TenantId (PMS-139 sweep batch 1) #159
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-139-sweep-rmm-time"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
First per-module batch of the PMS-139 typed-tenant-scoping sweep (on top of the merged foundation #158). Migrates
rmmandtime_tracking- both self-contained (no external callers of their services) and free of theaudit_writehub, so they're a clean, low-risk start.Pattern (the same one every later batch follows)
routes.rs):RequireRmm { user: u, .. }/RequireTimeTracking { user, .. }-> passu.tenant()instead ofuser.tenant_id.service.rs): every method (and the module-local helpers in time_tracking) takestenant_id: TenantIdinstead ofUuid..bind(tenant_id)and#[tracing::instrument(fields(tenant_id = %tenant_id))]are unchanged thanks to the transparent newtype +Display.Two boundary seams worth a look in review
POST /rmm/alerts) is unauthenticated (RMM agents, HMAC-signed) - there's noCurrentUser. It parses the tenant from the signedX-Tenant-Idheader and authenticates by HMAC against that tenant's per-connection secret. This usesTenantId::from_trustedwith an explicit// SAFETY:comment - exactly the named escape hatch the design reserves for out-of-band scope.TicketService+AuditCtx::system, so it unwraps withtenant_id.get()transitionally. These.get()s disappear when the hub modules are swept.Tests
--lib,--test rmm(3),--test time_tracking(1), and the doctest guard all green;clippy --all-targetsclean. Both modules' integration tests go through HTTP, so nofrom_trustedchanges were needed in tests this batch.Progress
Migrated:
reports(foundation),rmm,time_tracking. Remaining ~14 modules in subsequent batches; dev-docs cross-cutting #8 updated.🤖 Generated with Claude Code