Security & Isolation¶
Core requirements¶
I1-B3 adds a database-level isolation boundary: tenant-owned PostgreSQL tables use tenant_id plus Row-Level Security, with trusted transaction-local tenant context. RLS is defense in depth and does not replace application authorization.
- Every tenant-owned request resolves a trusted
TenantContextfrom hostname/site/API credential and authenticated membership—not from arbitrary body/query values. - Authorization evaluates platform role, tenant membership, business-unit scope and entitlement separately.
- Background jobs carry immutable tenant/site/business-unit identifiers and re-establish authorization context deliberately.
- Secrets never live in page/component JSON or ordinary integration configuration fields.
- Payment and advertising credentials use encrypted secret storage/reference tokens.
- Custom-site API credentials are scoped, revocable and origin/environment constrained where applicable.
- Admin impersonation/support access is explicit, time-bounded where possible, and fully audited.
- File/media authorization prevents cross-tenant object discovery.
- Rate limits differ by public, authenticated, admin and integration surfaces.
Security zones¶
Public visitor -> Public API -> tenant/site scoped read + conversion commands
Tenant user -> Tenant API -> membership + permission + BU/site scope
Platform staff -> Platform API -> platform authorization + audit
Custom site -> Public/headless API -> Custom contract + scoped API client
Sensitive mutations requiring audit¶
- role/membership changes;
- plan/entitlement overrides;
- domain verification/activation;
- payment/refund/withdrawal changes;
- pricing/availability overrides;
- booking status overrides;
- site publication/rollback;
- integration credential changes;
- advertising campaign state/budget changes;
- support impersonation.
Database privilege separation — I1-B3¶
Normal application requests use tenant-scoped runtime database credentials/paths with RLS enforced.
Privileged migration and explicitly authorized platform operations use separate credentials/paths. Privileged access must be narrow, observable and must not be reused as the normal tenant application connection.
Application authorization remains responsible for membership, role, Business Unit/Site scope and entitlement checks even when RLS permits tenant-level row access.
Authentication & identity — I1-B4¶
Keycloak 26.x is the platform identity provider for human authentication. Touriffique uses OIDC Authorization Code + PKCE for browser sign-in.
Touriffique does not use realm-per-tenant identity isolation. A single environment-level realm authenticates global Users, while tenant membership and authorization remain application-owned.
Password/direct-grant and implicit flows are forbidden for Touriffique applications.
The authoritative identity mapping key is the external OIDC issuer + subject pair, not email address.
Authorization — I1-B4¶
Authorization is application-owned and evaluates independent dimensions:
authentication
membership / platform-staff assignment
permission
resource scope
entitlement
domain policy
Roles are permission bundles. Application code must not rely on hard-coded role-name equality when a permission check is the intended rule.
Initial grants are allow-only/default-deny.
Tenant role assignments can be scoped to Tenant, Business Unit, Site or Location.
Platform staff permissions are maintained outside TenantMemberships.
MFA — I1-B4¶
MFA is mandatory for all platform staff and tenant staff.
Customer MFA is optional initially.
Passkeys/WebAuthn are preferred, TOTP is an accepted fallback, and account recovery must not weaken the assurance policy silently.
Sensitive operations may require step-up authentication.
Browser token protection — I1-B4¶
Durable authentication credentials, especially refresh/session credentials, must not be stored in JavaScript-readable browser persistence such as localStorage, sessionStorage or IndexedDB.
The exact server-session/BFF implementation for Tenant Admin and Platform Admin is deferred to the frontend technology gate.
Machine identities — I1-B4¶
Trusted server-to-server clients use OAuth 2.0 Client Credentials with Touriffique-owned application scope records.
Provider webhooks continue to use provider-specific verification/signature contracts rather than pretending to be human OAuth clients.