Security hardening
The coordinator holds coordination state: sessions, claims, intents, questions, decisions and the audit log. It holds no model keys for your agents and no git credentials, so a compromise exposes that state, not the power to push code. This page lists what Zentri does to protect it and what you should set up around it. The threat model in docs/plan/THREAT_MODEL.md has the full list of threats.
The container
Section titled “The container”The migrate and server services in deploy/docker-compose.yml run with these settings. Keep them when you run the image another way.
| Setting | Effect |
|---|---|
user: nonroot |
Runs as the distroless nonroot user, not root. |
read_only: true |
The root file system is read-only. |
cap_drop: [ALL] |
Drops every Linux capability. |
no-new-privileges:true |
A process cannot gain privileges. |
Ports on 127.0.0.1 |
Nothing outside the machine reaches the published ports. |
The Helm chart sets the same in its pod and container security contexts, and adds the RuntimeDefault seccomp profile, no service account token, and no service links. make test-helm checks every container and pod it renders.
The image is based on gcr.io/distroless/static-debian13:nonroot. It has no shell and no package manager. The end-to-end test scripts/e2e-m1.sh checks the Compose file for each setting above.
Network exposure
Section titled “Network exposure”Do not expose the coordinator to the public internet. Reach it over a private network, such as a tailnet. See Tailscale.
The coordinator serves plain HTTP. zt refuses plain HTTP for any host other than loopback, so put TLS in front. See Docker Compose.
Only these need to reach it:
| Caller | Credential |
|---|---|
zt on engineer machines |
A user token |
Agents in sessions, through zentri mcp and zentri hook |
A session token |
| The Slack bot | An integration token with slack:act-as-verified-user |
| The GitHub check | An integration token with checks:read |
| Prometheus | An admin token, or an integration token with metrics:read |
Only the coordinator needs to reach Postgres. If Postgres runs on another host, connect with sslmode=verify-full in the database URL.
Database roles
Section titled “Database roles”The coordinator does not connect as the table owner. It connects as zentri_coordinator, a member of zentri_app, and each migration grants that role only what the coordinator needs.
- It can read and insert rows in
audit_log, and nothing else. A test checks that it cannot rewrite the log. - Most tables allow it no
DELETE. The one exception isslack_links, so a person can unlink Slack. - Slack deliveries older than 30 days are deleted by
prune_slack_deliveries(), aSECURITY DEFINERfunction owned by theNOLOGINrolezentri_retention. The coordinator may only call it. It takes no argument and reads the database’s clock, so no caller can make it delete a younger row. - Claim rate buckets idle for an hour are deleted by
prune_claim_rate_buckets(), built the same way. A bucket idle that long is full, so the prune never changes a limit. - The owner role runs migrations only. Keep its password where migrations run, not in the server’s environment.
Tokens
Section titled “Tokens”ADR-0003 defines five kinds of credential. The coordinator stores only a hash of each one, and the logs show [REDACTED] in place of any token.
| Kind | Prefix | Lifetime | Held by |
|---|---|---|---|
| Invite | ztinv_ |
15 minutes, single use | A new user, once, for zt login |
| User | zt_u_ |
90 days | zt, in a 0600 config file |
| Session | zt_s_ |
8 hours, refreshed up to 24 hours | One agent session, in a 0600 file |
| Integration | zt_i_ |
365 days | The Slack bot, the GitHub check or Prometheus |
| Admin | zt_a_ |
No expiry | The bootstrap admin |
A user token has the scope of its user’s role. A session token has only the scopes one session needs, such as claims:own and notes:post, and it is revoked when the session ends. An integration token has exactly one scope:
| Scope | Allows |
|---|---|
slack:act-as-verified-user |
The Slack bot acts as a linked Slack user. |
checks:read |
The merge check. |
metrics:read |
GET /metrics. |
An admin creates an integration token with POST /v1/integration-tokens. The response shows the token once. Admins list tokens with GET /v1/tokens and revoke one with POST /v1/tokens/{token_id}/revoke. The HTTP API reference lists each route.
zt never takes a token as a flag and never prints one. It keeps the user token in the OS keychain when one answers: the macOS Keychain, the Windows Credential Manager, or the Secret Service on Linux. Where none answers, as over SSH or in a container, it keeps the token in a 0600 config file, and refuses that file when other users can read it. On a laptop, ZENTRI_TOKEN_STORE=keychain makes zt fail rather than fall back to the file. See the configuration reference.
The bootstrap token
Section titled “The bootstrap token”The first start creates an admin user and an admin token with every scope and no expiry. Treat it as a break-glass credential.
- Use it to create your first users and invites.
- Create a second user with the
adminrole (POST /v1/users) and invite them (POST /v1/users/{user_id}/invites).zthas no command for this yet. - Once that person’s
zt loginworks, revoke the bootstrap token.
To keep the token out of the container’s output, write it to a file and set ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILE before the first start. The file must hold zt_a_ and 43 letters and digits. Make it with a random source, and do not print it:
umask 077printf 'zt_a_%s\n' \ "$(LC_ALL=C tr -dc 'A-Za-z0-9' </dev/urandom | head -c 43)" \ > /etc/zentri/admin-tokenSecrets in files
Section titled “Secrets in files”Secrets come from files, never from a variable’s value or a flag. Mount each file read-only.
| Variable | Holds |
|---|---|
ZENTRI_BOOTSTRAP_ADMIN_TOKEN_FILE |
The first admin token. Optional. |
ZENTRI_EMBED_API_KEY_FILE |
The embedder’s API key |
ZENTRI_LLM_API_KEY_FILE |
The LLM’s API key |
ZENTRI_DATA_KEY_FILE |
The key that encrypts raw prompts |
A key’s type prints and logs as [REDACTED]. Model errors log a status code or a short reason, never the response body.
The Slack bot reads each of its secrets from a variable or from the file a <NAME>_FILE variable names. Setting both is an error. See Slack bot.
Raw prompts and the data key
Section titled “Raw prompts and the data key”Without ZENTRI_DATA_KEY_FILE, the coordinator does not store raw task prompts. With it, each prompt is encrypted with AES-256-GCM, bound to its project and intent. The LLM judge reads raw prompts, so it runs only with the key.
The file holds 32 raw bytes, 64 hex characters, or base64 of 32 bytes. Make one with:
openssl rand -hex 32 > /etc/zentri/data-keyBack up the key apart from the database. Without it, the stored prompts cannot be read. Key rotation is not built.
Model egress
Section titled “Model egress”By default nothing leaves the host: the heuristic extractor and the hash embedder run offline. A model is called only when you set its base URL, and only that URL is called.
| Setting | What the model receives |
|---|---|
| An embedder | The normalized task text, not the raw prompt. Also question texts, decision titles and texts, and decision search queries, after the secret scan. Symbol doc comments, cut to 300 bytes, only when the embedder is embeddinggemma:300m or nomic-embed-text:v1.5 on Ollama. Any other embedder never gets them, and the coordinator compares them itself. |
An LLM with the judge or extract step |
Every task prompt |
An LLM with the phrase step |
An agent’s question and the task line |
| The model router’s tiebreak | A task prompt, only in a project whose lead set llm: true, and only when the answer can change the model |
Point an LLM only at a service you trust with your task prompts. See Model routing.
The audit chain
Section titled “The audit chain”Every write adds a row to audit_log. Each row stores SHA-256(prev_hash ‖ canonical row), so changing or removing a row in the middle breaks the chain. ADR-0005 records the design.
Check the chain:
zentri-server audit verifyaudit chain ok: 1234 rows, head <hash>The command connects with ZENTRI_DATABASE_URL. It exits 1 and prints audit chain BROKEN at seq <n>: ... when a row does not match. In Compose, run it as a one-off container:
docker compose -f deploy/docker-compose.yml \ run --rm --no-deps -T server audit verifyThe chain alone cannot show that rows were removed from the end. Store each head hash somewhere the database admin cannot change, and compare it on the next run. Run the check on a schedule and before each upgrade.
Limits
Section titled “Limits”Rate limits are token buckets. The claim request bucket lives in Postgres, so every coordinator on one database shares it and a restart keeps it. The others are held in memory, per process. A refused call gets 429. The error code and the limiter label of zentri_rate_limited_total depend on the limiter:
| Limiter | Keyed by | Rate and burst | Error code | Metric label |
|---|---|---|---|---|
| Session token | Token | 20 a second, burst 60 | rate_limited |
session_token |
| User, admin or integration token | Token | 10 a second, burst 30 | rate_limited |
user_token |
| Anonymous calls and failed logins | Client IP | 5 a second, burst 20 | rate_limited |
anonymous |
| Each Slack user the bot acts for | Slack team and user | 1 a second, burst 10 | rate_limited |
slack_user |
| Claim requests | Session | 60 a minute, burst 60 | claim_rate_limited |
claims |
| Notes | Session | 10 a minute, burst 10 | note_rate_limited |
Not counted |
| Plans | Session | 30 a minute, burst 30 | plan_rate_limited |
Not counted |
| Snapshots | Session | 30 a minute, burst 30 | snapshot_rate_limited |
Not counted |
Only a rate_limited answer carries a Retry-After header.
The client IP is the TCP peer. The coordinator does not read X-Forwarded-For, so behind a proxy all anonymous calls share one bucket. /healthz, /readyz and /metrics are not rate limited.
| Limit | Value |
|---|---|
| Request body | 1 MiB (413 body_too_large) |
| Request headers | 64 KiB |
| Task prompt | 16 KiB |
| MCP tool result | 32 KiB |
| Snapshot patch | 512 KiB |
| Active claims per session | 500 |
| Paths per claim request | 500 |
| Open questions per session | 10 |
| Decisions waiting for review per session | 10 |
| Read and write timeouts | 30 seconds each, 5 seconds to read headers |
Secret scanning
Section titled “Secret scanning”The coordinator scans text before it stores it. It scans notes, plans, snapshots, and every field of a question, an answer, a decision, a review comment and a PRD revision. A match is replaced with [REDACTED:<kind>], the row records that it was redacted, and an audit row such as note.redacted records the kinds found, never the text.
It looks for these kinds: private_key, zentri_token, aws_access_key, github_token, gitlab_token, slack_token, stripe_key, google_api_key, api_key, jwt, url_credentials, bearer and assignment.
Sandbox egress
Section titled “Sandbox egress”The openshell launcher runs each agent in an OpenShell sandbox that denies network access by default. Every rule sets enforcement: enforce. Each kit’s policy allows:
- the coordinator, for
/usr/local/bin/zentrionly; - the agent vendor’s hosts, for the agent binary only;
- the origin remote, for
/usr/bin/gitonly.
No package registry is allowed. make lint runs scripts/check-openshell-policies.sh, which fails on a rule without enforce. An agent can still send what it reads to its own vendor, so the vendor host stays a path out that a policy cannot close. See OpenShell policies and Sandboxing.
The local-dev launcher, the default, does not sandbox agents. See The coordinator is not a sandbox.
Not built yet
Section titled “Not built yet”The threat model defers these:
- mTLS between the launcher and the coordinator, and the launcher daemon with Ed25519-signed requests.
- Encryption of raw prompts with an external KMS.
- Rate limiting across coordinator replicas for every limit but claim requests.
- Integration tokens limited to one project. Today a
checks:readtoken can run the merge check on any project in the org. - Export of the audit chain head to an external store, planned for the enterprise edition.
- Passing the session token through an OpenShell provider, so the agent never holds it.
Report a vulnerability
Section titled “Report a vulnerability”Do not open a public issue. Follow SECURITY.md in the repository: a GitHub private vulnerability report, or email.