KynetraDB tenancy model

Multi-tenancy

Project data is namespaced by a kind prefix, and project-scoped credentials are confined to their own project's namespace. Platform accounts and the global key are operator credentials with deployment-wide authority: they span projects by design. Issue them only to operators, and keep operator endpoints, including platform account creation, reachable only by operators. See Security for the limits. This page also states plainly what tenant erasure does not do, because an erasure endpoint that implies more than it delivers is a compliance liability.

2 separation layers6 ProjectStatus statest_{pid}___ kind prefixtombstone erasure, not crypto

Bulkhead · layer 1 of 2

Kind-prefixed namespaces

Like a ship's watertight compartments, the namespace is meant to keep one tenant's data apart from another's. Every tenant entity is kind-prefixed, so a project-scoped credential's reads, writes and exports address its own project's namespace — the prefix is part of the index key, not a filter applied afterwards.

scoped_kind — the tenant namespacetext
t_{project}___{kind}

t_acme___posts        # tenant "acme", collection "posts"
t_acme___user         # tenant "acme", auth users
t_globex___posts      # a different compartment entirely

# The namespace is a prefix, not a per-request check:
# because the cascade scans a kind PREFIX, a project id containing an
# underscore could match a neighbour's namespace — so project ids are
# REJECTED unless '_'-free on every path, including the orphan sweep
# where no row exists to cross-check against.

A credential that is not scoped to a project addresses the unprefixed namespace, where tenant data does not live. On the live demo deploy, the global service key returns {"collections":[]} for that reason, because tenant data lives under t_<project>___coll:*. That is namespace addressing, not a limit on platform credentials, which span projects by design.

Bulkhead · layer 2 of 2

The platform-vs-project auth plane

Every credential carries a platform_identity bool, set once at resolution. The checks consult it before any role or uid comparison, so a project-plane credential is not treated as holding platform authority, even while it holds its own project's jwt_secret. Platform-plane credentials are operator credentials and span projects by design.

CredentialPlaneplatform_identityCan manage another org?
Global service keyplatform trueyes
Unscoped platform JWTplatform trueyes
Studio session, genuinely super_adminplatform trueyes
Per-project service keyproject falseno
Per-project anon keyproject falseno
Project end-user JWTproject falseno

is_super_admin, require_platform_admin andcan_manage_org all check the flag first. AuthCtx derives onlyDebug + Clone — no Deserialize, no Default, no struct-update sites — so the flag cannot be set from untrusted input or inherited from a default. The design landed after three adversarial review rounds.

ProjectStatus

Lifecycle and limits

Status is resolved fail-closed: an unresolvable or unknown project is denied rather than allowed through. Note that Paused is deliberately not a hard stop — reads and token refresh keep working, so a paused tenant's users are not logged out.

StatusReadsWritesToken refreshIntent
Provisioning no no noAuthentication is refused until the project becomes Active. New projects are created directly as Active today.
Active yes yes yesNormal operation.
Paused yes no yesReversible. Sessions survive; the tenant is not logged out.
Suspended no no noEnforcement action.
Deprovisioning no no noAuthentication stops immediately. The purge runs from this state and can be re-driven.
Purged no no noTerminal. A completed purge removes the project row, so this state appears only in the audit record.

Per-project quotas are not configurable yet

The engine can hold an entity quota for a project, but nothing in this edition sets one, so a project has no entity cap by default. Do not rely on a quota to stop one tenant from exhausting shared capacity.

Default request budget

A default request budget applies to each project and is set by the operator through an environment setting. A per-project override exists in the data model, but nothing in this edition sets it.

Signature-verified namespace

Namespace selection is signature-verified, so a client cannot simply assert a namespace.

Scoped reads cost O(tenant)

A per-kind index makes a tenant-scoped read cost O(that tenant). Ram is default-on; Disk is default-off. See benchmarks.

Ferry

Per-tenant export with auth-material redaction

A tenant's namespace exports as integrity-hashed NDJSON, read from one pinnedEngine::snapshot() — consistent with no writer quiesce and no torn output. The insight worth stating: "this is my tenant's data" and "this is safe to hand out" are different questions.

KindIn export?Why
auth_otp excludedUnsalted SHA-256 of a 6-digit code — brute-forceable in milliseconds.
auth_refresh excludedSession token hashes; an export containing them is a session-replay vector.
user.password_hash emptiedThe user row travels; the credential does not.
Everything else under t_{pid}___ includedPrefix-scoped: the export reads only the project's own prefix.

Integrity is a canonical content hash over the header — which carries the project id — plus every entity line, with attribute keys recursively sorted. A relabelled or tampered file therefore fails verification before a single entity is written, and the importer additionally takes --expect-pid. Egress is audited in the hash-chained admin log, refused for Deprovisioning and Purged tenants, and byte-capped.

Ebb

Tenant erasure — and what it is not

Tenant decommissioning that states exactly what it deletes and no more. A purge tombstones every t_{pid}___* entity, destroys the tenant's keys, then compacts. It is idempotent and resumable by construction.

What a purge does

  • Tombstones every entity under the tenant's kind prefix.
  • Destroys the tenant's keys, so remaining bytes are unauthenticatable.
  • Compacts, so the data is absent from the compacted checkpoint.
  • Re-lists kinds after each sweep until none remain, then lets an honest live recount decide completion — not the loop's own counter.
  • Leaves the project row and skips compaction if incomplete, so the purge can be re-driven rather than silently half-finishing.

Declared scope

erasure_scopetext
"live checkpoint + retained WAL"

The data becomes unreadable through every query path, absent from the compacted checkpoint, and unauthenticatable. That is the whole claim.