On this page
In short#
Organizations share tables; the host picks the organization, row-level security forced on every organization table filters the rows, and no runtime identity can bypass it. Brands are a second partition inside an organization.
Secrets are envelope-encrypted and never returned, identifying names are masked at display, and sign-in is configured per organization.
Two tenancy tiers#
An organization is one customer. A brand is a workspace partition inside it, not a separate tenant: every fact or asset table carries both ids. Organization-wide administration reads across brands; brand-scoped reporting does not (Multi-brand workspaces).
| Rule | How it holds |
|---|---|
| Brand access | Membership belongs to the organization; viewable brands decide which brands a member enters |
| Brand authorization | Decided in the application; the brand policy leg is the safety net under it |
| Ingest is brand-bound | Single-brand organizations pin automatically; a missing or disagreeing brand is refused |
| Shops | A marketplace shop belongs to exactly one brand |
| Super admins | No membership anywhere; the console names the organization it acts on in the URL |
How isolation works#
- The host resolves the organization. Before any tenant scope exists, fixed-shape database functions exchange one exact host for one organization id. On a tenant subdomain or verified domain the host wins over the cookie; an unknown host resolves to nothing.
- The resolver runs in one pinned transaction. The procedure sets organization and brand as transaction-local settings on one connection and runs the whole resolver there; a failed mutation rolls back.
- The database applies the policy. Organization tables match the pinned organization; brand-partitioned tables add a brand leg, where an unpinned brand means the organization-wide rollup. The policy is forced, so the table owner is not exempt, and an unset setting denies: no context, zero rows.
- The identity cannot bypass it. Web, worker and backup each connect as their own role without superuser or bypass rights and refuse to start on any other; grants come from one declared manifest after a full revoke.
Tables outside row-level security carry a threat-modelled entry in a checked-in exceptions file; cross-tenant work uses fixed-shape database functions granted to one role.
Threats and the layer that stops each#
Rate limits apply to every mutating, sign-in and webhook endpoint; a sign-in that cannot be checked is refused, a webhook signature is validated before its body is parsed, and the client address comes from the connection peer or a configured proxy hop only.
Secrets, masking and sample data#
- Envelope encryption. Connector credentials, directory bind passwords and channel secrets use AES-256-GCM under a versioned key; each row records its key version; rotation keeps prior keys until a tested rewrap proves them unused.
- Store verbatim, mask at display. Ingest keeps exactly what the source returned, so numbers reconcile. Buyer-identifying fields render masked by default and are revealed only by explicit action; an organization declares names to mask and which roles see them masked (Identity masking).
- Sample data is flagged. Every fact table and brand carries
is_sample, so demo rows never reach a real KPI and seeding one brand never touches another.
Sign-in and request protection#
| Area | Rule |
|---|---|
| Methods | Password, magic link, WebAuthn passkeys, TOTP two-factor, Google sign-in when configured |
| Directory | Per organization: LDAP/AD or OpenID Connect, turned on by a super admin |
| LDAP | Bind fails closed, encrypted by default, no auto-created accounts, super admins refused |
| Sessions | 14 days, rolling 24-hour refresh, revocable by sid; httpOnly and secure cookies outside local development |
| Input | Named Zod schema on every API input; user HTML sanitized before rendering |
| Outbound | Sent only when platform, organization and person all allow the channel; in-app by default |
A TOTP code is accepted once: a reused time step is refused. Setup: Set up LDAP/AD login and Notifications.
Sessions and sign-out everywhere#
Each sign-in writes an auth_sessions row and stores its sid in the token, so a stateless token is revocable. Every request checks the row. The issuer's end_session call sets revoked_at through an internal route and then sends a back-channel logout to each connected app holding that sid. The session check is cached for 60 s. A token minted before the table existed gets a row on its first request.
Connected apps sign in through the MSO issuer with PKCE and private_key_jwt; an access token carries exactly one org (App family and sign-in).
Where it stops#
Masking is a display layer, not anonymization. An archive never carries secrets, and a restore does not bypass isolation (Back up and restore an organization). OpenID Connect login and white-label custom domains are not yet proven against live providers: Project status, last verified 3 October 2026.
Decisions#
| Decision | Why | Enforced by |
|---|---|---|
| Every organization table has a forced policy; a missing tenant pin denies | An application filter fails open when one query forgets its clause; a policy fails closed | Tenancy gate: policy inventory; no-context and wrong-organization reads return zero rows |
| One transaction wraps the resolver; any function reaching organization data opens its own scope | A lost pin reads zero rows, which an entitlement check takes as the most permissive answer | Behavioural tests per scope call site, worker audit, null-brand ratchet, outbox audit |
| Each runtime uses an exact non-bypass role; grants come from one default-deny manifest | A bypass role skips the forced policy while every tenancy test still passes | Boot identity check, deploy grant-drift stop, gate run as the deployed identity |
| One resolver derives the organization from the host; one helper builds absolute URLs | A cookie-derived origin sends a redirect or an erasure to the wrong tenant | Audits on session-organization reads and origin-built URLs; full reload on a switch |
| Brand-partitioned writers always set the brand; every rollup key contains it | A key without the brand shows the sum of all brands inside each one | Brand-isolation gate leg, brand-scoped reconciliation, one brand resolver that refuses |
A table without org_ is read only through one reader that needs an org proof; only the worker writes it |
RLS cannot gate a table with no tenant key; a second door would be ungated | Shared-dataset single-reader audit, reader tests, runtime ACL manifest |
| Secrets are envelope-encrypted and never returned; names stored verbatim, masked at display | A secret in a log or archive is a breach; a per-surface mask decision leaks names | Pre-commit security scan, unmasked-field audit, single masking resolver, leak tests |