Tenant isolation verified at the database, explained without hype
BookDoc protects outpatient clinic boundaries through PostgreSQL Row-Level Security, least-privilege database roles, scoped public tokens, and append-only audit trails — and states its current boundaries plainly.
Discuss Security in a Demo
Five architectural boundaries protecting clinic and patient data
Database-Enforced Clinic Data Isolation
Every tenant-scoped clinical and operational table retains a tenant_id and enforces PostgreSQL Row-Level Security.
- ENABLE ROW LEVEL SECURITY and FORCE ROW LEVEL SECURITY across all 42 tenant-scoped tables.
- Composite tenant-aware foreign keys prevent cross-tenant record relationships.
- Runtime database role (bookdoc_app) has no superuser or BYPASSRLS privileges.
Membership & Role-Based Access Control
Clinic access is determined by verified clinic membership and role, never by a tenant ID supplied by the browser.
- Backend guards enforce ADMIN, DOCTOR, and RECEPTIONIST boundaries on every endpoint.
- Short-lived access JWTs paired with persisted, rotating refresh sessions and family revocation.
- Scoped public tokens (bdk_, bds_, bdu_) are rejected on staff clinical routes and scrubbed from audit logs.
Append-Only Audit Trail & Financial Immutability
Clinical writes, administrative mutations, and sensitive reads are recorded in tenant-scoped append-only audit logs.
- UPDATE, DELETE, and TRUNCATE are revoked on audit_logs for the runtime database role.
- Payment transactions and issued invoice line items enforce database-level immutability with compensating reversals.
- Clinic-day audit reconstruction helps administrators review operational history.
Verified Patient Linking & Release Boundaries
In the planned Global Patient Account portal, linking a personal account to a clinic record requires verified identity confirmation.
- Never relies on name, phone number, or NIC equality alone; requires a short-lived challenge or staff-assisted check.
- Anti-enumeration responses with expiry, attempt limits, rate limits, and replay protection.
- Explicit publication/release rules keep internal staff notes private by default.
Zero-PHI Platform Administration
Planned platform superadmin controls for clinic lifecycle and subscriptions are strictly separated from clinical content.
- Platform superadmins manage tenant status, plans, and aggregate non-clinical health metrics only.
- No general-purpose browsing of patient names, charts, prescriptions, lab reports, or attachments.
- Subscription suspension never silently deletes clinic data.
Honest Boundaries & Non-Certification Notice
BookDoc does not claim third-party regulatory or security certifications (such as HIPAA, GDPR, ISO 27001, SOC 2, or Sri Lankan PDPA certification), nor does this page constitute legal advice or a formal SLA/uptime guarantee. Clinical drug-interaction checking is currently a demonstration stub only, and opt-in AI lab extraction always requires explicit doctor preview and confirmation before saving.