RBAC (api/internal/authz) is live on /query and /dashboards, backed by a new enterprise/ module (session issuance, audit logging, RBAC storage, OIDC/SAML protocol wiring) that core never imports -- only calls over HTTP. Found and fixed a real cross-tenant vulnerability in dashboards (no tenant_id filtering at all) while writing the threat model doc. Two things are explicitly NOT done, documented rather than hidden: tenant isolation for log data itself (/query still shares one ClickHouse connection and Tantivy index across every tenant -- RBAC controls who can query, not what a query can see), and human SSO login (protocol wiring exists, no HTTP handler calls it yet). See docs/security/threat-model.md and docs/phase-4-runbook.md. Also adds deploy/ (Go Operator + Helm chart, validated offline only -- no cluster was reachable in this environment).
18 lines
916 B
SQL
18 lines
916 B
SQL
CREATE TABLE IF NOT EXISTS tenants
|
|
(
|
|
id TEXT PRIMARY KEY,
|
|
display_name TEXT NOT NULL,
|
|
-- Provisioning state machine from /docs/phase-4-isolation-design.md:
|
|
-- every tenant-resolution path must refuse to serve a tenant not in
|
|
-- 'active' state, checked server-side against this column.
|
|
status TEXT NOT NULL DEFAULT 'provisioning'
|
|
CHECK (status IN ('provisioning', 'active', 'suspended', 'deprovisioning')),
|
|
clickhouse_database_name TEXT,
|
|
tantivy_index_path TEXT,
|
|
-- Nullable until the first Owner exists -- a tenant can be created
|
|
-- (provisioning) before any user has logged in to claim ownership.
|
|
owner_user_id UUID REFERENCES users(id),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
)
|