.env.example is the canonical list; this page is its documented form. Settings
are grouped by what they govern, and each required variable states what happens
if it is absent.
Without an env file: the mail relay (
SMTP_*, REQUIRE_EMAIL_VERIFICATION,
PASSWORD_RESET_ENABLED), ANTHROPIC_API_KEY, Stripe (BILLING_PROVIDER,
STRIPE_*), TRUSTED_PROXIES, AUDIT_CHECKPOINT_KEY and AUDIT_CHECKPOINT_DIR,
KMS_PROVIDER and KMS_KEY_ID, and the off-host backup target can instead be
entered by a platform admin on the staff console’s
platform setup page, stored encrypted, and tested
there. A variable set here still wins.Required
Four variables must be present in a deployed environment. Two of them are also required in development, and two are generated for you there.
Generate both secrets with
openssl rand -hex 32.
JWT_SECRET_PREVIOUS (optional) is set only while rotating JWT_SECRET: the old
secret, which still verifies the tokens it signed (each token names its key in
a kid header) but never signs a new one. Set it to the old value when you
install the new JWT_SECRET, keep it for REFRESH_EXPIRY days (default 7),
then remove it. Rotating without it logs every user out. It must be at least 32
characters and must differ from JWT_SECRET.
What happens when a secret is missing
It depends onENV, and that is the point.
In development or test, the backend generates 32 random bytes per
process and logs loudly that it did so. There is no setup step, and sessions do
not survive a restart. A previously hardcoded default for JWT_SECRET, the
same published literal the config layer defaulted to, meant anyone who read the
repository could forge a token for any user. That was a real security finding,
and generating an ephemeral key is what replaced it: a key that does not exist
cannot leak.
In any other environment, a missing or weak secret is a fatal startup error.
Values equal to or prefixed by a known placeholder are refused at any length, in
any environment, because a placeholder that once shipped in a repository is
public by definition.
TOKEN_ENCRYPTION_KEY is a master key. Every stored secret is sealed under a
key derived from it for that secret’s purpose, and the cursor-signing key, the
secret-finding salt and the evidence pack
signing key are derived from it too. A pack signed before the key changed keeps
its old key id; auditctl verify-pack then needs the old value. Setting one value sets them
all, so a deployment cannot forget one and silently fall back to an empty
secret.
Replacing the value on its own makes every stored secret unreadable. Rotate it
with the keyring below instead.
Encryption key rotation
Both variables are optional, and both default to “this deployment has never rotated”.
Startup refuses a keyring that would lose data: a version above 1 with any
lower version missing from
TOKEN_ENCRYPTION_KEYS_PREVIOUS, a previous key
claiming the current version, a version listed twice, or a key that is not 32
bytes of hex. Changing the variables is half of a rotation; the other half is
reencrypt. Follow
Rotate the encryption key end to end.
Envelope encryption and KMS
Each organization’s secrets are sealed under that organization’s own data key, which is stored only wrapped by a key encryption key. See Envelope encryption.Server
Frontend origins
DASHBOARD_URL is also the whole CORS allow-list, and CORS permits credentials,
so it matters more than a display URL would. WEBSITE_URL is not on the
allow-list: the website never calls the API, and because the website and the
API are usually same-site, listing it would let any script on the website read
authenticated API responses.
There is deliberately no wildcard option. A previous
AllowOrigins: "*" let any
origin call the API with a stolen bearer token, which combined with a token
readable from localStorage turned any XSS into a full account takeover.
Sessions are HttpOnly cookies with SameSite=Lax, which imposes a deployment
constraint: the API and the dashboard must share a registrable domain.
api.example.com and app.example.com do; example.com and example.net do
not. The default arrangement proxies the API under the dashboard’s own origin,
which is same-site trivially.
Sessions and tokens
Data
Redis is an optimisation, not the system of record. Job state lives in
PostgreSQL, so losing Redis costs latency rather than work. See
Scaling.
Database connection pool
Read by the API and the worker. The limits are per pool, and a worker with its ownJOB_DATABASE_URL opens two pools, so count each API process
once and each such worker twice before comparing with the server’s
max_connections. migrate refingerprint and reencrypt use the same pool
size and ignore both timeouts, because a sweep over every organization
legitimately outlives any bound a request may have.
Durations are written as
30s, 5m or 1h. A value that does not parse
falls back to the default rather than to zero, because zero would silently
remove the bound a typo was meant to adjust. See
Scaling.
Scanning
See Scanning for how these interact.
Registry policy
The private-address rule is checked on the target when a scan is requested,
and again on every connection the scan makes, after the name is resolved. See
Scanning.
These are about network reachability, not authentication. Credentials for
registries that require a login are stored per registry host through
/api/v1/registry-credentials and are not configured by environment variable. A
secret in a process environment is a secret in docker inspect, in a crash
dump and in every child process.
Vulnerability database
See Vulnerability database, which
is where the reasoning behind two thresholds belongs.
Threat intelligence: KEV and EPSS
The two feeds the risk score reads. The worker fetches each on a schedule, stores it, and re-applies it to every stored finding. Nothing is fetched at startup, and a failed fetch never stops the process: the previous data stays in force, the error is recorded, and the data is flagged stale as it ages.GET /api/v1/system/status reports each feed’s source, version, age, staleness
and last error.
A URL source goes through the same SSRF-guarded transport as webhook delivery,
so it cannot reach a private or link-local address. An in-perimeter mirror is
served with the
file source. See Risk scoring.
AI assistant
Ask AI in the console (AI assistant). Off unlessANTHROPIC_API_KEY is set; then each organization’s admin still has to turn
it on. Questions, and the organization data the assistant reads to answer
them, are sent to Anthropic.
Rate limiting and webhooks
The rate limit is protection, not billing. Nothing here meters usage or prices
a plan. It is generous on purpose: a pipeline polling a scan every two seconds
for ten minutes makes three hundred requests, and a limiter that interrupts
legitimate work teaches customers to retry harder.
WEBHOOK_ALLOW_PRIVATE_DESTINATIONS logs a prominent warning when enabled, and
the server refuses to start with it set when ENV is not development. Even when set, the link-local range 169.254.0.0/16, which hosts cloud
instance metadata, stays blocked.
Sign-up and the staff console
Billing
Optional. With nothing set, the deployment sells nothing and plans are assigned by an operator. See Billing provider.Observability
Metrics are cross-tenant aggregates, so binding this to
0.0.0.0 publishes
facts about your business to anything that can route to the host. See
Health and metrics.
Identity providers
Optional. Configure only the providers you intend to offer. See Sign-up and sign-in for the callback URLs to register and what an unconfigured provider answers.
Redirect URIs default to
http://localhost:8080/api/v1/auth/<provider>/callback
and must match what is registered with the provider.
Outbound mail
Optional. With no relay, address verification, password reset, invitation mail and email alerts answer that mail is not configured (503,
mail_unavailable: true); invitations still work, and the administrator is
handed the link to send. See Send mail through your SMTP relay.
A half-configured relay (any
SMTP_ variable without SMTP_HOST, or a host
without SMTP_FROM) stops the process at startup. Links in mail point at
DASHBOARD_URL.
Branding
Optional. The identity the backend uses in customer-visible text. The dashboard’s name, colours and logo are separate build arguments, below. See White-label branding. An organization’s own brand and custom sign-in domain (Enterprise) are set in the product and need no variable. The domain check uses the host’s DNS resolver, and the edge’s certificate check calls/internal/tls/ask on the
API; see Custom sign-in domain.
Each of the three addresses must be an absolute
http(s) URL, or the process
refuses to start.
Dashboard build arguments
The dashboard is a separate program and reads none of the variables above. Everything it reads is fixed when its image is built: Next.js inlinesNEXT_PUBLIC_ values into the build output and resolves the API proxy
destination at build time. Setting any of these on a running dashboard
container has no effect. Pass them as --build-arg to
dashboard/Dockerfile.
Proxying under the dashboard’s origin is the default arrangement because it
keeps the session cookie same-origin. Pointing the browser at a separate API
origin with
NEXT_PUBLIC_API_URL puts you under the same-site constraint in
Frontend origins.
The production Compose file
infra/docker/docker-compose.prod.yml reads a few variables of its own from
infra/docker/.env. None of them is read by a TRUSTIVAN process. See
Production Compose.
The backup scripts read their own settings from the same file. See
Backup and recovery.
The trustivan command
The CI gate is a client, not part of a deployment, and reads its own
variables: TRUSTIVAN_API_KEY, TRUSTIVAN_URL, TRUSTIVAN_IDEMPOTENCY_KEY,
TRUSTIVAN_PR_OWNER, TRUSTIVAN_PR_REPO, TRUSTIVAN_PR_NUMBER and
TRUSTIVAN_GITHUB_INSTALLATION_ID. See
trustivan.
Settings that no longer exist
S3_* were declared but never read, and were removed. If you find them in an
old .env, they do nothing. (SMTP_* were removed the same way and have since
returned with real meaning; see above.) The MinIO service they configured was
removed along with them. It is AGPL-3.0, the one copyleft licence whose network
clause reaches a service, and an unused dependency is cheap to delete and
expensive to explain in a compliance review.