Security & Multi-Tenancy
Vorian Connect is built for multi-tenant lab environments where data isolation is non-negotiable. Every database table is protected by PostgreSQL Row-Level Security. Patient identifiers are pseudonymised before storage. Authentication uses Zitadel OIDC with short session timeouts. All admin actions are audited.
How It Works
- Tenant isolation at the database layer: Every table that stores tenant data includes a
tenant_idcolumn. PostgreSQL Row-Level Security policies (enabled on all 14 tenant tables) ensure that even buggy application code cannot leak data across tenants — the database itself enforces the boundary - Dual database roles: The dashboard connects using a restricted
nextgen_approle that has RLS enforcement enabled. Administrative operations (invite token lookup, schema migrations) use a superuser role that bypasses RLS — only public routes and migration tools use this path - PHI pseudonymisation: Patient MRNs are never stored in plaintext. On first encounter, the MRN is HMAC-SHA256 hashed with a tenant-scoped key and mapped to a random UUID token. All subsequent references use the token — the raw MRN is unrecoverable without the HMAC key
- Authentication via Zitadel OIDC: Self-hosted Zitadel provides OpenID Connect authentication with configurable session timeouts, forced re-authentication, and multi-factor support. No third-party auth provider dependency
- Role-based access control: Two roles: admin and member. Admins manage destinations, team invitations, and audit logs. Members view messages, topology, and rules. The invitations flow uses a token-based acceptance pattern with database-level locking to prevent race conditions
- Admin audit logging: Every admin action (destination CRUD, team management, GDPR erasure requests) is recorded to
admin_audit_logwith the actor's identity, action type, target details, and IP address
What's Included
- Row-Level Security: PostgreSQL RLS policies on all tenant-scoped tables, enforced by the restricted
nextgen_appdatabase role. Policies are idempotent and re-runnable - PHI pseudonymisation: HMAC-SHA256 MRN hashing → UUID token mapping in
patient_tokenstable. Patient data inanalyte_resultsreferences tokens, not raw identifiers. GDPR Art. 17 erasure deletes the token mapping, anonymising all associated results - Zitadel OIDC authentication: Self-hosted identity provider with NextAuth v5 integration. Session timeouts, forced re-authentication, and lazy tenant provisioning on first login
- RBAC + team invitations: Admin and member roles with per-endpoint enforcement. Invitation flow with token-based acceptance, expiry, and concurrent-safe claim via
FOR UPDATErow locking - Admin audit log: Immutable record of all admin actions with actor, action type, target details (JSONB), and source IP. Queryable from the dashboard audit page with pagination and expandable target details
- Transport security: Edge agent to gateway communication over mTLS 1.3. Dashboard served over HTTPS. Delivery webhooks signed with HMAC-SHA256. SSRF protection on FHIR delivery
- SQLite at-rest encryption: Message payloads buffered on the edge agent are encrypted before writing to disk. Encryption failure aborts the write — plaintext is never stored
- Message-log retention: A partition-drop mechanism for
message_logsremoves monthly message partitions older than a configurable window (default 1 year), with a dry-run mode that reports the drop statements without executing them. It is not run automatically — live execution requires explicit approval
Where It Fits
Security controls span the entire Vorian Connect pipeline. At the edge, SQLite encryption protects buffered messages on the lab machine. In transit, mTLS 1.3 secures the agent-to-gateway tunnel. At rest in PostgreSQL, RLS enforces tenant boundaries and MRNs are pseudonymised. At the application layer, RBAC controls what each user can see and do. In the audit trail, every admin action is logged for compliance review.
For multi-site hospital networks and reference labs serving multiple clients, tenant isolation means each lab's data is invisible to every other lab — even to users with database access. The RLS policies are the hard gate; no application-layer logic can accidentally bypass them.
Technical Details (for evaluators)
RLS policies follow the pattern: tenant_id = current_setting('app.tenant_id')::uuid. The app.tenant_id session variable is set at connection time via SET LOCAL within a transaction. This means RLS is active for the duration of every dashboard API request and reset between requests — no cross-request tenant leakage.
PHI pseudonymisation uses HMAC-SHA256 with a key shared across all services (gateway, dashboard, reprocessor). The key is never exposed to the edge agent. GDPR erasure (DELETE /api/patient) is admin-only and removes the token mapping — results become permanently anonymised while preserving analytical continuity for QC and population statistics.
Zitadel is pinned to v2.65.2 and runs in the Docker Compose stack. User provisioning is lazy — the first time a user logs in via Zitadel, the dashboard auto-creates their user record and tenant. Subsequent logins look up the existing tenant association.