Identity foundation
This is a development foundation, not an authentication system cleared for
real users or visitor data. It uses the Rails authentication generator with
password authentication, server-side session records and password reset tokens.
A user can belong to multiple tenants through one membership per tenant. A
tenant selection is accepted only if the signed-in user has that membership;
with_authorized_tenant rechecks it before entering tenant context.
No self-registration or tenant provisioning UI is included. A development-only
operator task for creating an organization and its first administrator is
documented in organization-provisioning.md. Organization
selection is a minimal workflow, not a complete product interface. Site and
incident permissions, tenant-specific role semantics and background-job tenant
authorization remain to be implemented.
Before actual accounts or external exposure: implement MFA; durable, shared rate limiting and abuse monitoring; session expiry and revocation controls; secure account provisioning; reviewed password and recovery policy; configured and tested transactional mail; audit events; and security review. Membership tables currently rely on application-level authorization and are not yet protected by their own RLS policy. Do not treat the current app role as a safe boundary against arbitrary SQL or expose membership data directly.
Tests run in a dedicated _test database prepared by the migration role, then
with the restricted application role. Rails’ automatic test-schema maintenance
is disabled; migrate the test database explicitly before running the suite.