1. Multi-tenant model
Azora is a row-level multi-tenant system. There is one application, one PostgreSQL database, and one process per node — and every customer-data table carries an indexed account_id column.
-- Simplified example of a tenant-scoped table:
CREATE TABLE tasks (
id text PRIMARY KEY,
account_id text NOT NULL REFERENCES cp_accounts(id) ON DELETE CASCADE,
title text NOT NULL,
...
);
CREATE INDEX tasks_account_id_idx ON tasks (account_id);
The generic record routes use a shared helper to add an account_id filter for tenant users:
// Webbased/src/db/tenantDb.ts
const scope = tenantReadCondition(tasks, identity);
// Tenant user: account_id = the signed-in tenant.
// Control Plane admin: no tenant filter.
Application-layer separation: tenants share one PostgreSQL database. The generic record routes use the scoping helpers in tenantDb.ts; dedicated routes, including authentication, Control Plane and settings, apply their own access checks. This is not a separate database or PostgreSQL RLS boundary for each tenant.
Control Plane support access
A Control Plane admin's generic reads are unfiltered for support; generic tenant-record writes are refused for that identity. Provisioning records and cp_audit_log are separate tables in the same database. Read-audit coverage depends on the route (§5); this does not establish a log of every Control Plane read or restrict a database owner or superuser.
2. The Control Plane
The Control Plane (CP) is Azora's vendor administration surface for provisioning, billing and support. It has a separate route tree (/dashboard/control-plane) and records its application actions in cp_audit_log. Tenant users cannot use the CP; CP admins can read workspace records for support.
Identity model
A CP admin is a user row with account_id IS NULL. That single column is the landlord marker. There is exactly one CP admin per environment by default, seeded by migration 0004_seed_cp_admin_and_cleanup.sql.
Server-side identity checks gate CP access:
- The user row must have
account_id IS NULL (DB marker)
- If
CP_ADMIN_NAMES or CP_ADMIN_EMAILS is configured, the resolved name or email must also match a configured allowlist. This optional identity restriction is not an additional authentication factor.
Both are evaluated server-side in deriveIsCpAdmin. The flag is stamped onto the session cookie and the JWT at login; subsequent requests check it via middleware.
What the CP can and can't do
| Capability | CP admin | Tenant admin |
| Provision a new tenant | Yes | No |
| Suspend or cancel a tenant | Yes (logged); physical deletion requires a separate review (§10) | No |
| Read tenant business data (tasks, CAPAs, etc.) | Permitted for support; read logging depends on the route | Yes (own tenant only) |
| Assist an existing user with password recovery | Directs the verified user to the same Forgot Password flow; cannot choose or set the secret | Directs the verified user to Forgot Password; cannot choose or set the secret |
| Create a tenant user | No human CP path | Yes — through audited Administration provisioning/invite |
| View billing events | Yes | Own tenant only |
Tenant-user passwords are purpose-bound to user custody: the Control Plane has no tenant-user Add User, initial-password, or Set Password control, and generic CP automation cannot submit the exact reviewed DEC-223 password-field set. That finite server contract is not an arbitrary case-folded or generic secret-field rule. Once an active tenant admin exists, later users are onboarded through tenant Administration. First-tenant-admin activation remains a separate approval-bound product-policy gate; CP account creation, credential-free service identities, and verified reset do not bootstrap it. This does not disable unrelated reviewed service automation or change the separate operator bootstrap for the tenantless landlord account.
3. Authentication & sessions
Password hashing
Passwords are hashed with bcrypt (cost factor 12), never stored or logged in plaintext. Hash columns are never returned by API endpoints; the hash is consulted only inside the password-check helper.
Session cookies
Sessions are sealed with iron-session. The cookie is HttpOnly, Secure, SameSite=Strict in production, and includes session.isCpAdmin + session.accountId stamped at login. Cookies are sealed with SESSION_SECRET — rotating that secret invalidates every active session.
JWT API tokens
API access uses JWTs signed with HS256 against the same SESSION_SECRET. JWTs include a per-user revocation watermark (users.jwt_issued_at): logout, password change, suspension, or admin force-logout all bump the watermark, and any JWT issued before that timestamp is rejected.
// Effect: a stolen JWT is invalidated server-side
// without needing a per-token blocklist.
if (jwt.iat < user.jwt_issued_at) reject();
TOTP 2FA
Per-user TOTP secret with bcrypt-hashed backup codes. Two-state secret model (pending vs. active) prevents TOCTOU on enrollment — the secret only becomes "active" after the user verifies a code from it. TOTP secrets at rest are AES-256-GCM encrypted; see §4.
Username enumeration
Login responses are normalized: identical timing and identical error message regardless of whether the username exists. Failed-login rate-limit is per-username AND per-IP.
External portal bearer lifecycle
Azora's external customer-intake, supplier, and auditor portals use one retained tenant grant whose opaque 64-hex bearer is stored only as a SHA-256 hash. A current tenant admin or president must state a reason and bind one exact form, same-tenant vendor, or approved auditor view/stable-project-ID/exact-label/expiry scope. Reused project labels across any retained lifecycle fail closed; legacy name-only project grants remain listable and revocable but cannot authorize public project use. The server rechecks the active tenant, live role, session watermark, and per-login custody inside the PostgreSQL transaction that creates or permanently revokes the grant and its exact tamper-evident Administration audit receipt.
- A newly committed issuance releases the raw URL once in a non-cacheable response. Azora does not persist, log, or email that bearer.
- The tenant plus retained intent deterministically identifies the grant. Exact replay returns the same safe grant with the credential withheld; a lost bearer is revoked and reissued, never recovered or re-revealed.
- Every public request rechecks the active tenant, exact retained type/scope/status, and database-clock expiry while holding the same grant fence used by revocation. Accepted usage and its business/audit evidence commit together; revoke-first blocks use, while use-first evidence remains retained.
- Malformed, unknown, cross-tenant, inactive, expired, revoked, drifted, and unavailable grants share one generic not-found response so the portal cannot disclose grant or target existence.
- The browser blocks duplicate submission and navigation during an unresolved ceremony, keeps the validated one-time URL only in volatile memory, resets mutation results immediately, and clears URL custody after copy acknowledgement, authority rotation, or unmount. Bounded durable non-bearer retry data plus a minimal cross-tab marker survive reload/restart and never time-release uncertainty from list absence or a later refusal.
Qualification boundary: DEC-224 changes no database schema and currently represents reviewed local source and documentation, not a production-rollout claim. Approved real-PostgreSQL OQ, controlled-browser execution, cumulative migration/audit preflight, exact Web restart, deployment, production, credentials, customer/external approval, and other manual release gates remain pending.
4. Encryption-at-rest
Four credential columns are encrypted at the application layer with AES-256-GCM. Nothing else in the database, business records included, is encrypted by the application.
// Envelope format stored in DB:
// "enc:v1:<iv-hex>:<tag-hex>:<ciphertext-hex>" (AI provider key: "enc:aik:v1:…")
//
// 12-byte IV, 16-byte GCM auth tag, ciphertext — all hex-encoded.
// Key: the 32 bytes of TOTP_AT_REST_KEY, or, when that is unset,
// HKDF-SHA256(SESSION_SECRET, info "azora-totp-at-rest-v1").
// The AI provider key uses its own HKDF subkey (info "azora-ai-key-at-rest-v1").
const iv = randomBytes(12);
const { ciphertext, authTag } = aesGcmEncrypt(plaintext, key, iv);
db_value = `enc:v1:${iv.toString('hex')}:${authTag.toString('hex')}:${ciphertext.toString('hex')}`;
Versioned envelope prefix (enc:v1:) gives forward compatibility for future cipher migrations — the helper picks the decryption path off the prefix. The read path still accepts a value stored before encryption shipped. A build check fails when code encrypts a column under this key that the key-rotation script does not list.
Encrypted by the application (AES-256-GCM)
- Authenticator (TOTP) secrets, active and pending (
users.totp_secret, users.totp_pending_secret)
- Webhook signing secrets (
webhook_endpoints.secret)
- A tenant's own AI provider key (
cp_accounts.ai_key_cipher)
Stored as one-way hashes
- Passwords (bcrypt) and two-factor backup codes
- Azora API keys and external portal links (SHA-256)
Not yet encrypted
- License keys (
cp_licenses.license_key)
- R2 / S3 storage credentials (in
app_settings)
- CI/CD provider tokens (e.g. GitHub PATs in
cicd_config)
These are stored as plain text. No date is set for encrypting them.
Not encrypted by the application
- Business records — tasks, CAPAs, vendors, etc.
- Uploaded files
- Email addresses (used for login, indexing, search) and other settings
Disk, database and key-management arrangements depend on the deployment; review them during a security review. The documented hosted backup procedure encrypts backups before they leave the server; ask for current execution evidence.
Why not encrypt everything: Application-layer column encryption breaks indexes, full-text search, joins, and any meaningful query. We encrypt the credentials a database breach would otherwise expose as usable elsewhere. Business data is protected by tenant isolation, access control and audit logging, not by application-layer encryption.
5. Audit logging
The application records supported tenant-record mutations in entity_audit_log. Evidence fields include:
- Actor:
changed_by, attributed by the owning application workflow
- Tenant:
account_id
- Action:
create / update / delete
- Entity:
entity_type and entity_id
- Changes: details recorded by the owning workflow, with sensitive fields redacted
- Timestamp and route-specific request context
Control Plane actions use cp_audit_log; tenant Administration actions use admin_audit_log. Quality-scoped events also use quality_audit_log.
Read-audit logging
Selected routes, including the tenant and Control Plane audit-log APIs, include read-audit instrumentation. Coverage and failure handling depend on the route. This does not establish logging of every business-record view, every Control Plane read, or direct database access.
Append-only enforcement
The reviewed database triggers reject ordinary UPDATE or DELETE operations on the four audit tables (entity_audit_log, quality_audit_log, admin_audit_log, cp_audit_log). Corrections must be appended with a reference to the original entry. Database owners and superusers can bypass these controls, disable triggers, rewrite history and recompute hashes; the application does not guarantee a record of that disablement. See migration 0030_audit_log_security_bundle.sql and the deployment-specific role and privilege review.
Tamper-evident hash chain
Each new audit row stores a chain_hash computed by a database BEFORE INSERT trigger. Retained algorithm versions 1 and 2 bind their historically defined field sets; algorithm 3 uses a type-tagged binary encoding that binds every non-self audit field, including tenant identity, predecessor, algorithm, and database-owned timestamp. The verifier at GET /api/v1/audit/verify-chain?table=entity captures one fixed head and follows predecessor hashes backward with an opaque continuation. It reports integrity, complete-versus-partial coverage, unsealed rows, binding coverage, algorithm mix, and inferred-but-uncheckpointed transitions separately. Only a complete walk of sealed algorithm-3 history is labelled fully verified. Blank pre-chain rows remain retained but cryptographically unattributed, and the historical global-to-tenant cutover has no durable checkpoint from which to claim more.
A chain kept only in the same database cannot independently establish that a database owner has not rewritten it. The documented off-box anchoring procedure calls for retaining chain-head witnesses outside the server's write authority. Those witnesses can support comparison with previously retained heads; they do not verify the full history. Ask for current export, comparison and custody evidence before relying on that operational control.
Retention
Cancellation deactivates access; it does not automatically purge audit history. Audit retention follows the records it supports, applicable legal holds and protected-record rules. Any physical deletion or erasure request requires a separate scope and retention review (§10); a cascading foreign key is not authorization to delete protected evidence.
6. Compliance posture
ISO 13485
Azora's QMS workflows follow the ISO 13485 process model: the solution ships with CAPA, NCR, change control, audit management, a risk register, a traceability matrix, document control, and training records. Internal QMS uses Azora itself.
What we are not: Azora is not ISO 13485 certified. Customer organizations may use Azora as part of their own quality system, but certification depends on the organization’s processes, implementation, and audit.
21 CFR Part 11
Electronic signatures capture signer identity, signature statement (intent), timestamp, IP address, and user-agent on CAPA close-out, NCR disposition, and test execution. The underlying audit log rejects ordinary updates and deletes at the database level, and its SHA-256 hash chain lets the verifier detect alteration of past audit entries, within the database-owner limit described in §5. Corrections are new versions that supersede the original.
SOC 2
SOC 2 readiness work is on the roadmap. Azora does not hold a SOC 2 report today and does not claim one. See the trust roadmap →
HIPAA
Azora is not currently sold as a HIPAA-compliant system, and we do not currently sign BAAs. Customers who need HIPAA workflows should evaluate carefully — the architecture includes audit logging, encryption, and access controls, but those controls alone do not establish HIPAA compliance.
SSO / SAML / SCIM
Planned for enterprise service engagements; not currently shipped. See roadmap →
7. May 2026 internal security review findings
An internal security review was recorded in May 2026. The table below groups C-1 and C-2 in one row and records the listed dispositions, including M-2's later supersession by DEC-214. The related issue history is retained in Azora's internal bug tracker; ask for the exact scope and current evidence during a security review.
| ID | Severity | Area | Status |
| C-1 / C-2 | Critical | app_settings cross-tenant secret leak + tenant-admin clobber (R2/S3 + license-key plaintext exposed to any logged-in user) | Closed (server-side scrub-on-read + preserve-on-write; the keys are not yet encrypted at rest, see §4) |
| H-1 | High | sync_queue exposed cross-tenant via /api/v1/sync-queue (no account_id column, broken filter mapping) | Closed (removed from CRUD allowlist) |
| H-2 | High | Stored XSS via DocumentsPanel <iframe src> + <img src> with no scheme allowlist | Closed (safeUrl() + scheme allowlist at render time) |
| H-3 | High | /api/auth/2fa/setup + enable accepted session-only auth — account takeover via stolen session | Closed (password required at setup) |
| H-4 | High | /api/v1/auth/validate-token skipped JWT revocation watermark check | Closed (now calls verifyJwtForUser) |
| H-5 | High | JWT revocation silently no-ops in production when DATABASE_URL is unset | Closed (fail-closed in prod) |
| M-1 | Medium | /api/v1/auth/register response shape leaked username existence | Closed (response normalized to { ok: true }) |
| M-2 | Medium | /api/admin/seed-timesheet missing admin/president role check | Superseded by DEC-214 (exact-live-authorized retired 410 within quota / 429 above quota; no synthetic writes) |
| M-3 | Medium | Tenant /api/audit GET had no read-audit logging | Closed (mirrors the CP pattern) |
| M-5 | Medium | TOTP seeds stored as plaintext base32 at rest | Closed (AES-256-GCM envelope, see §4) |
The bcrypt cost factor (currently 12, see §3) was raised as part of broader hardening, not as a numbered audit finding. This page publishes the finding summary; supporting review material can be discussed with qualified buyers through sales@azorasolutions.com.
8. Threat model
What we protect against
- Cross-tenant data leak. Mitigation: application-layer
account_id scoping in generic record routes and dedicated access checks in other routes. Control Plane support reads and direct database authority have the limits described in §1–2.
- Credential theft from DB dump. Mitigation: bcrypt for passwords, SHA-256 hashes for Azora API keys, AES-256-GCM for the four credential columns in §4. A dump still holds the plain-text license keys, storage credentials and CI/CD tokens listed in §4, so database dumps and backups need their own protection.
- Stolen JWT replay. Mitigation:
jwt_issued_at watermark — logout/password-change invalidates server-side without a blocklist.
- Unauthorized CP escalation. Mitigation:
account_id IS NULL as the marker, with optional CP_ADMIN_NAMES / CP_ADMIN_EMAILS allowlists. Tenant admins cannot escalate by editing their own row.
- Alteration of retained audit entries. Mitigation: reviewed triggers reject ordinary UPDATE/DELETE operations on the four audit tables. The fixed-head verifier at
/api/v1/audit/verify-chain recomputes supported row hashes, follows predecessor topology, and reports complete, partial, unsealed, legacy-binding or invalid coverage. Runtime role restrictions and retained off-box witnesses require target-specific operational evidence; database-owner and superuser authority remain outside this application control (§5).
- Username enumeration. Mitigation: identical response shape and timing for "user not found" vs "wrong password."
What we don't protect against (out of scope)
- Compromised customer endpoint. If a tenant admin's laptop is keylogged, Azora cannot help. Use 2FA to limit blast radius; SSO is not currently shipped.
- Insider threat at Azora. Database-owner or superuser access can read tenant records and bypass application controls. Application audit tables do not establish a record of every direct database read. Production-access restrictions, MFA and independent access logging require separate operational evidence. Azora is not zero-knowledge.
- Physical hardware compromise. Disk-layer encryption depends on the deployment. Hosted and self-host infrastructure controls are documented during the security review; the application-level secret encryption described in §4 is separate.
- Cipher breakthrough on AES-256. If AES-256 falls, the column-encryption envelope versioning lets us migrate ciphers, but we don't promise post-quantum readiness today.
- Supply-chain compromise of a dependency. Mitigation is partial:
pnpm lockfile, dependency review on every PR, no auto-merging dependabot. A targeted attack on a critical dep is still possible.
9. Self-host model
Self-hosting is offered through an enterprise services agreement. It uses the same codebase, database schema, and deploy script. Deployment, updates and data access are defined in that agreement.
What you get
- The full Azora codebase as a deployable artifact (Next.js app +
deploy.sh + Drizzle migrations)
- Reference deployment is Ubuntu 24.04 + PostgreSQL 16 + Nginx + PM2. Compatibility with other deployment targets requires review under the agreed support model.
- Schema migrations versioned in
drizzle/; we provide migration scripts for each release.
- Updates follow the supported operator procedure supplied with the services agreement. Each release selects an approved full 40-character source commit and reviews every migration between the deployed and target commits, regardless of minor or major version labels.
The human operator completes the target-specific schema-readiness ceremony, including required migration and catalog/privilege checks, before setting both DEPLOY_COMMIT and DEPLOY_SCHEMA_READY_COMMIT to that same approved commit. Schema-readiness attestation is required even when the source change itself contains no migration; it must not be used to bypass a failed check. Accept the exact candidate on staging before production promotion, then retain target-specific verification receipts.
What you give up
- The Control Plane is hosted-only by default. On self-host, billing/provisioning is manual or through your own tooling.
- Auto-scaling: a self-host deploy is single-node by default. Multi-node Postgres + app-server fan-out is possible but on-you-to-configure.
- Outage recovery: Azora owns the hosted-product runbook; on self-host, your operations team owns the deployment runbook under the agreed support model.
Why self-host
Common reasons: data residency requirements, internal IT policy, regulated industries with explicit "data must stay in our network" clauses, or simply preference. We don't gate features on self-host vs hosted — same code, same modules.
10. Data lifecycle & deletion
On tenant provisioning
Azora provisions each tenant and inserts seed data under its tenant identifier before issuing credentials. The marketing site does not create tenant accounts automatically.
While active
Tenant-user routes apply workspace access checks; vendor support and database authority have the boundaries described in §1–2 and §8. Backup encryption, location, and retention are deployment-specific controls documented for the hosted environment or in the self-host services agreement.
On suspension
Tenant data remains intact; access is denied at the auth layer. CP admin can re-activate. Cancellation deactivates access; there is no automatic 30-day purge.
On deletion / cancellation
The current cancellation route marks the account cancelled and suspends its users. The schema also defines cascading foreign keys for a separately authorized physical deletion:
account_id text NOT NULL REFERENCES cp_accounts(id) ON DELETE CASCADE
Cancellation does not invoke that physical deletion path or authorize an audit purge. An erasure request requires a separate scope and retention review, including legal holds, protected records and the evidence that must be retained.
Data export
No export is gated by plan, edition or tier; roles decide who can export. On every plan:
- Workspace records export (administrator or president): one JSON file of the workspace's operational and compliance records. It leaves out HR records, clinical study records, uploaded files and links to them, and the change-history tables. It is not a backup, and there is no import or restore path.
- Record PDFs: supported quality records export as a single-record PDF that includes the record's change history.
- Administration audit log: exports to CSV (administrator or president).
- Panel exports: about a dozen panels export their current view as CSV or PDF.
Contact us to arrange tenant closure.
11. How to engage us
This brief covers the questions security teams ask in the first 90% of their evaluation. For the last 10%:
- Send your security questionnaire. Email sales@azorasolutions.com; scope, supporting material, and response timing are confirmed for the evaluation.
- Schema walkthrough. We'll open a screen-share and step through the Postgres schema, the
tenantDb.ts scoping helpers, the audit log structure, and any specific table you want to see. 30–45 minutes.
- Audit supporting material. This page contains the published finding summary. Ask sales which underlying material can be shared for your evaluation.
- Self-host demo. If you're evaluating self-host, we'll spin up a reference deployment and walk you through the deploy script, the migration story, and the operations model.
For everything else: security@azorasolutions.com. We answer.