Learn · Scale & operations
Security & data lifecycle
Dedicated clusters isolate every organization. Schema rules, regional root pins, retention sweeps and value-blind audit logs govern your data from write to deletion.
Dedicated cluster and storage isolation#
Every Napalm cluster runs on dedicated compute, memory and attached disk volumes. No PostgreSQL 18 process, engine memory space, disk volume or network path is shared across organizations. Automated fault campaigns verify tenant and permission isolation on every release. See Scale and recovery.
Per-organization compute, shard and bucket isolation
Dedicated engines, PostgreSQL primary and replica volumes, encrypted commit archives and object storage buckets run behind <label>.napalmdata.com.
| Cluster layer | Isolation boundary | Encryption and key custody |
|---|---|---|
| Engines | Dedicated engine processes per cluster behind a cluster-specific HTTPS hostname (<label>.napalmdata.com). In-memory read caches partition entries by caller identity and policy context. | Encryption and key custodyAutomated TLS certificate issuance and renewal via napalm clusters address (POST /). |
| Database shards | Dedicated PostgreSQL 18 primary and replica members per shard. Replicas run in separate availability zones within the shard’s region. | Encryption and key custodyEncrypted transport across all client and inter-member connections. Each branch generates an isolated ES256 keypair for session and action assertions. |
| Backups and commit archives | Per-shard base backups and continuous commit archives stored outside the database volumes. | Encryption and key custodyEncrypted under a dedicated per-cluster key. Commits archive within 60 seconds. |
| Object and search buckets | Dedicated private file bucket, public file bucket, search-segment bucket and change-log bucket per cluster (POST /, POST /, POST /). | Encryption and key custodyScoped per-cluster bucket credentials. Private file reads require short-lived presigned URLs gated by schema select policies. |
| Tokens and external secrets | Org tokens, service keys and project secrets scoped to one organization, project or branch. | Encryption and key custodyOrg tokens (napalm_…), service keys (ndb_…) and action secrets are shown once and stored only as SHA-256 hashes. Provider keys, SMTP passwords and handler secrets stay encrypted at rest. |
Temporary credentials supplied for bulk external S3 migrations (napalm files store import or POST /) are encrypted on receipt and permanently erased as soon as the import completes, fails or is canceled. See How Napalm works for cluster shapes.
Control plane and data plane separation#
Napalm separates infrastructure management on the Control API (https:/) from application traffic on each project’s data-plane hostname (https:/). No credential works across both planes, and no data-plane credential ever runs as a database superuser.
Non-overlapping plane credentials
Value-blind napalm_… org tokens stop at api.napalmdata.com, while ndb_… keys and eyJ… sessions execute under branch access policy rules.
Deployed-query and origin lockdown
--passthrough keys, --hide-schema and --allow-origin confine browsers to compiled POST /query/{name} calls from approved origins.
| Credential | Target plane | Identity in schema | Privilege ceiling |
|---|---|---|---|
Org token (napalm_…) | Control API (read or manage) | Identity in schemaNone (never executes data-plane queries) | Privilege ceilingManages clusters, schemas, deployed queries, keys and retention (30-day default TTL). Never reads or mutates application row values. Acts within the current permissions of the manager who created the token. |
Service key (ndb_…) | Project API (one branch) | Identity in schemaglobal caller := {} plus serviceGlobals and per-key --global values | Privilege ceilingExpires in 1 to 365 days. Optional --read-only ceiling. Obeys all schema access policy rules. Cannot call the Control API, alter schemas or impersonate a user. |
User session (eyJ…) | Project API (one branch) | Identity in schemaVerified ext::auth::Identity in global ext::auth::ClientTokenIdentity plus userGlobals | Privilege ceilingIssued via OAuth 2.0 PKCE S256 at GET /sign-in/token (up to 365 days). Re-checked against the live Identity row on every request. |
Agent grant (eyJ…) | Project API, /mcp and /a2a | Identity in schemaGranting user’s Identity plus global ext::napalm::ClientTokenAgentGrant (or a dedicated agent Identity) | Privilege ceilingBounded by the user’s own access, optional read-only consent and row-level expiration rules on ext::napalm::AgentGrant. |
Endpoint hardening and statement sandbox#
Every stored object type in Napalm is closed by default until an access policy grants access. Layer endpoint controls on top of your schema rules before opening a project to production browsers or external agents.
- Deployed-query lockdown
- Set
--passthrough keysso browsers and user sessions can invoke only compiled queries atPOST /query/{name}, or--passthrough noneso every caller, service key and agent is restricted to deployed queries (403 deployed_query_requiredotherwise). - Schema visibility
- New endpoints hide schema introspection by default (
--hide-schema/isSchemaShared: false), disablingGET /schema,POST /askand MCP schema discovery tools. - Browser origin allowlist
- Configure up to 32 exact HTTPS origins via
--allow-origin(http://localhostis permitted for local development). Browser requests from unlisted origins fail with403 forbiddenbefore credential checks. - Outbound host allowlist
- Schema expressions cannot call
std::net. Restrictnotifywebhooks and action handlers to approved HTTPS destinations withnapalm webhooks hosts(POST /), rejecting other hosts withprojects/ {id}/ webhooks/ hosts 409 host_not_allowed. - Single-statement sandbox
- The Project API accepts HTTPS only and refuses raw SQL and Gel’s binary protocol. Each call runs one data statement (1 MiB request limit, 16 MiB result limit, 60-second statement timeout) and rejects DDL, multi-statement scripts,
configure,set globaland system modules (sys,cfg,schema) with400 query_rejected.
# Require deployed queries from browsers, hide schema introspection and allow one browser originnapalm endpoint notes --passthrough keys --hide-schema --allow-origin https://app.example.com # Restrict outbound webhooks and action handlers to approved HTTPS hostsnapalm webhooks hosts notes --add hooks.example.com # Preview reach first, then issue a read-only service key for a background workernapalm keys reach notes --new --read-onlynapalm keys create notes --label worker --read-only --days 30See Sessions and keys, Key and secret renewal and Napalm and Gel for full credential and sandbox details.
Regional placement and root pinning#
When you provision a cluster (POST /clusters), you select the region for the cluster’s engines and database shards using three-letter region codes such as iad, dfw or fra. On clusters with replicas, every write commits synchronously to a replica in that same region before returning to the caller.
Per-root regional residency pins
napalm placement keep <project> <root> --region <region> migrates one tenant root tree to an in-region shard and blocks future moves outside that jurisdiction.
Multi-tenant projects can keep regulated customers in specific geographic regions inside one shared deployment by combining schema roots with regional shards and root overrides. Enabling root placement (napalm placement enable or POST /) maps every tenant root (such as Organization) and descendant rows linked via required owner links without changing primary keys or application queries.
# Map every row on main to an inferred tenant rootnapalm placement enable notes --wait # Split main's shard to add a dedicated regional shard in Frankfurtnapalm placement split notes --shard shard-k3m9x2p7qa --region fra --wait # Pin one regulated customer's Organization UUID to Frankfurtnapalm placement keep notes 0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f --region fra # Verify active bucket assignments, root overrides and regional pinsnapalm placement show notes- Regional shard splits
- Run
napalm placement split <project> --shard <name> --region <region>(POST /) to provision a data shard in a new region and move half of the source shard’s buckets online.projects/ {id}/ shard-splits - Root residency pins
- Run
napalm placement keep <project> <root> --region <region>(POST /) to record a regional root override. If the root sits outside that region, Napalm migrates the root online to the least-loaded branch shard in the target region while reads continue and writes pause briefly at cutover. Missing regional capacity returnsprojects/ {id}/ roots/ {root}/ region 400 no_shard_in_region. - Move guardrails
- Once a root carries a regional pin, automated rebalancing and manual
POST /calls refuse any move to a shard outside that region withprojects/ {id}/ bucket-moves 400 outside_region. Pass--anywhere({ "region": null }) to clear the pin. - In-region root restores
- Running
napalm placement restore-root(POST /) rewinds one tenant root and descendant records from shard backups back onto the shard holding that root without rolling back other tenants or leaving the pinned region.projects/ {id}/ root-restores
Deletion, retention and storage sweeps#
When a customer or end user exercises right-to-erasure, a delete statement cuts off application visibility at commit while retention windows and background sweeps govern when underlying bytes age out of historical logs, backups, file buckets and vector segments.
Root erasure receipts and storage sweeps
napalm placement erase-root deletes a customer tree in one transaction with an Ed25519-signed receipt, while napalm storage sweep purges aged-out file and search objects.
Immediate visibility cutoff at commit#
Committing a delete removes the target rows in that exact transaction across EdgeQL queries, POST /subscribe live streams (emitting a removed patch), POST /search and ext::ai vector and full-text scans. On GET /changes, types governed by row-level select policies (checked access) omit deleted field values and emit only the deleted object id.
Deleting a user’s ext::auth::Identity record invalidates every active session and OAuth agent grant for that person on the next request (401 invalid_session) and closes open live streams with session_ended. Private file_url links never issue for a deleted record. Any presigned URL handed out before deletion expires after the 1-hour signing window plus the 6-hour link validity ceiling. Public files (file_is_public := true) remain reachable at unsigned URLs until the file sweep deletes the unreferenced object. An erase of a whole root deletes the root’s public files at once.
Export or erase one customer#
A root is the object that owns a group of rows, such as a customer’s organization. Because Napalm tracks the owning root for every row, a single command exports or erases an entire customer without listing individual types by hand.
# Export one customer's rows and files into a ZIP archive, kept for seven daysnapalm placement export-root notes 0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f --out customer.zip # See what an erase would delete and keep. Nothing changes.napalm placement erase-root notes 0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f --plan # Erase the customer and save the signed receiptnapalm placement erase-root notes 0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f --receipt receipt.json- The export
napalm placement export-root(POST /) snapshots the root and every descendant row into a single ZIP archive containing JSON Lines per type and all stored file bytes. Napalm retains the archive for seven days for org managers to download via a signed link.projects/ {id}/ root-exports - The plan
POST /answers the plan by default, andprojects/ {id}/ root-erasures --planstops the CLI at the plan. The plan counts every item slated for deletion: rows by type, link rows, files, search entries and sign-in identities exclusive to that customer. The plan also lists rows outside the root that link in, and names any link rule that blocks deletion before anything changes.- The erase
- One transaction deletes the root’s rows, so no reader sees half a customer. Rows that the schema’s link rules delete with the root go too. Rows of other customers stay unless the request says
--outside. The bytes of the customer’s public files are deleted with the erase, since a public link never expires. - The receipt
- The operation produces an Ed25519-signed receipt tallying deleted and retained records alongside the exact expiration date across backups, private files, search segments and the change log. Verify signatures against
GET /receipt-keys. - After a restore
- A branch restore to a moment before an erasure brings the customer’s rows back. Napalm then queues the erasure again, and the second operation ends with a receipt of the second erase.
How deleted bytes age out across storage tiers#
| Storage tier | Default retention | Purge mechanism and controls |
|---|---|---|
| Database pages and backups | 7 days included (7, 14, 30 or 90 days) | Purge mechanism and controlsPostgreSQL reclaims space from deleted rows on active volumes. Encrypted base backups and continuous commit archives expire automatically as nightly backups advance past the window configured via napalm storage keep <cluster> backups --days <n> (POST /). |
| Change-log history | 30 days included (30 days, 90 days, a year or 7 years) | Purge mechanism and controlsSet project, pull-request or per-branch windows with napalm branches keep (POST / or POST /) or cluster defaults with napalm storage keep <cluster> log --days <n>. Shortening a window drops older days within the hour. Purge retained logs from deleted branches immediately with napalm branches forget (POST /). |
Object storage (ext::files::File) | Backup restore window | Purge mechanism and controlsDeleted or replaced files stay retained while a point-in-time restore inside the backup window can still reference those bytes. Once outside the restore window, the nightly sweep or napalm storage sweep <cluster> files (POST /) deletes unreferenced objects and expired uploads. |
Vector segments (ext::ai::index) | Next publish plus backup window | Purge mechanism and controlsDeleted records are excluded from search results at commit. For indexes in the segments tier, napalm search publish <cluster> <index> --retrain (POST /) writes a compacted segment version without deleted vectors, and napalm storage sweep <cluster> search (POST /) removes superseded datasets once outside the restore window. |
# Delete a customer's root record under your schema's access policiesnapalm query notes "delete Organization filter .id = <uuid>\$org" --var org=0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f # Shorten change-log retention on main and purge a dropped branch archivenapalm branches keep notes main --days 30napalm branches forget notes pr-42 --yes # Shorten backup retention, publish compacted search segments and sweep bucketsnapalm storage keep prod-cluster backups --days 7napalm search publish prod-cluster Document --retrainnapalm storage sweep prod-cluster filesnapalm storage sweep prod-cluster searchFile and search sweeps intentionally preserve objects that fall inside the active backup retention window so a branch or single-root restore never produces broken file links or missing index datasets. To satisfy a tight compliance erasure deadline, lower backup retention first, allow older backups to age past the shortened window and then run napalm storage sweep. When an entire cluster is decommissioned (tornDown), compute and endpoints stop immediately, and Napalm permanently deletes the cluster’s storage buckets after 60 days (bucketDeletionTime). Remove any custom domain CNAME records before bucket deletion, as documented in Torn-down clusters.
Model provider data boundaries#
Napalm never uses your schemas, rows, files or queries to train models. No text leaves your cluster for an external model provider unless you declare an ext::ai::index in your schema or call a natural-language question endpoint (POST /ask, napalm ask or the ask agent tool).
Explicit model boundary
External embedding and /ask synthesis models receive only declared ext::ai::index expressions or caller-permitted question context, and never unindexed fields, policies or file bytes.
| Operation | Exact data sent to the model provider | Never sent |
|---|---|---|
Background indexing (ext::ai::index) | Only the string produced by the index’s on (…) expression on inserted or updated rows, deduplicated within each batch. | Never sentUnindexed columns, unindexed types, access policy expressions and ext::files::File bytes. |
Semantic search (POST /search, ext::ai::search) | Only the caller’s search query text to embed the query vector. Passing <array<float32>>$embedding in a deployed query sends nothing. | Never sentStored database rows and rows filtered out by the caller’s select policies. |
Questions in words (POST /ask, napalm ask) | The branch SDL schema, the caller’s question and any compiler error from a failed retry, plus read-only result rows unless "answer": false (--no-answer) is set. | Never sentRows unreadable by the asking caller, unrequested tables and write mutations (proposed writes never execute automatically). |
- Napalm managed models
- Provisioned with a per-project key and monthly spend ceiling (
napalm models <project> --giveorPOST /). Managed requests route exclusively to providers that do not retain or train on submitted prompts or embeddings.projects/ {id}/ models - Project-owned provider keys
- Attach your own OpenAI, Mistral or Anthropic API key via
napalm models <project> --add <provider> --secret-stdin(orNAPALM_PROVIDER_SECRET). Calls bill directly to your provider account under your own data-processing agreement, and Napalm never returns the stored secret. - Zero-model operation
- Projects that omit
ext::ai::index, keep--hide-schemaenabled and remove model providers make zero external model requests. Keyword ranking viafts::indexandfts::searchruns entirely inside PostgreSQL 18.
# Inspect configured model providers and current monthly managed spendnapalm models notes # Supply your own OpenAI key through stdin so secrets never appear in shell argumentsnapalm models notes --add openai --secret-stdin < openai.key # Run a natural-language query without sending result rows back to the modelnapalm ask notes "Which invoices are past due?" --no-answer # Remove a provider key so the project stops calling that providernapalm models notes --remove openaiSee Models and embeddings for provider configuration and Privacy policy for subprocessor commitments.
Zero-exposure debugging and audit logs#
On-call engineers never need production service keys, policy bypasses or direct SQL access to diagnose why a customer cannot read or write a record. Policy explanations and reach checks run inside the engine and report rule-by-rule outcomes without returning customer field values.
Value-blind operator diagnostics
napalm explain-access evaluates allow and deny rules and empty link hops without returning row fields, logging projectPersonAccessChecked in napalm activity.
- Value-blind access explanations
- Run
napalm explain-access <project> <object-id> --as <person>(POST /) to evaluate everyprojects/ {id}/ explain-access allowanddenyrule on one object UUID and identify empty link hops without exposing row fields. Every--ascheck writes an immutableprojectPersonAccessCheckedentry to organization activity. - Reach counts and query telemetry
- Run
napalm people reach(GET /) orprojects/ {id}/ people/ {identity}/ reach napalm keys reach(GET /) to count readable, updatable and deletable records and file bytes per type. Performance statistics inprojects/ {id}/ keys/ {key}/ reach napalm insights(GET /) strip query parameter values and literals before aggregation.projects/ {id}/ insights - Control-plane audit log
- Run
napalm activity(GET /events) to inspect chronological organization events with the acting user ID, org token ID, actor type and timestamp across schema pushes (projectSchemaMigrated), key changes (projectKeyIssued,projectKeyRevoked), backups and restores (backupRequested,restoreRequested,rootRestoreRequested), sweeps (fileSweepRequested,searchSweepRequested) and person access checks. - Commit provenance
- Every committed transaction records caller kind (
session,keyorengine) and protocol source (http,mcpora2a). Operators inspect commit timestamps, caller kinds and per-type row counts without field values vianapalm changes(GET /), while authorized data-plane consumers read policy-filtered row changes fromprojects/ {id}/ changes GET /changes.
# Evaluate access rules on one object UUID as a user without reading field valuesnapalm explain-access notes 0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f --as maya@acme.co # Inspect chronological organization audit events, including projectPersonAccessCheckednapalm activity --limit 50 --json # Review committed transaction counts, caller kinds and protocol sources without row valuesnapalm changes notes --since 24h --jsonImmutable in-transaction audit tables#
GET /changes records caller kinds and protocol sources rather than user identities. When compliance requires per-person attribution on every write, declare a schema trigger that inserts an immutable audit row inside the committing transaction using global caller (and global ext::napalm::ClientTokenAgentGrant when agents act on a user’s behalf). If the audit insert fails, the entire mutation rolls back.
using extension auth;using extension napalm;using future simple_scoping; module default { global caller := global ext::auth::ClientTokenIdentity; type Note { required title: str; owner: ext::auth::Identity; access policy owner_has_full_access allow all using (.owner ?= global caller); trigger record_change after insert, update for each do ( insert Change { note := __new__, changed_by := global caller, title := __new__.title, } ); } type Change { required note: Note; changed_by: ext::auth::Identity; required title: str; required at: datetime { default := datetime_of_statement(); }; access policy note_owner_can_read allow select using (.note.owner ?= global caller); access policy callers_record_as_themselves allow insert using (.changed_by ?= global caller); }}See Troubleshooting and auditing, Watching and stopping an agent and Organization and tokens for complete event schemas.