Reeve Docs

Docs / Security

Secrets at rest and the audit trail

How the platform keeps secrets it must store, how it keeps them out of responses and logs, and what the audit trail records. Operator procedures are in secrets.

Purpose-isolated protection

Every secret category is encrypted through its own data-protection purpose over a database-backed key ring shared by every replica (constraint):

Category Examples
Second-factor secrets TOTP shared secrets
Integration settings Identity-provider client secrets, plugin configuration
Repository credentials Plugin, blueprint and widget repository access
Plugin OAuth tokens Tokens obtained on a plugin's behalf
Per-plugin blobs Arbitrary plugin-owned encrypted storage
Runtime settings Operator-set values that are secret
Object-storage payloads Media and export payloads
Workload command rows Request payloads and responses of commands routed between replicas (setup codes, Thread datasets); cleared once delivered or consumed
Workflow secret headers HttpRequest node headers, with the workflow id as sub-purpose (below)
Matter bridge media tickets Short-lived tickets any replica reading the ring can verify; expiry is enforced by the protector

Letting the framework own key derivation, initialisation vectors and tag verification means key material lives in exactly one place, survives restarts, and is readable by every replica. A per-process derived key silently produces ciphertext that another replica cannot read.

The keys themselves live in integration.data_protection_keys, so a database backup carries the material that decrypts the secrets in it; losing that table loses every ciphertext it protected, and the table is therefore as sensitive as the secrets it protects. Alongside the key, each ciphertext is bound to the application discriminator, the content root path (/app/ in the shipped image). That binding is part of the data format, not a security control: anyone holding the table can set the content root to /app/. Running against the same database from another content root (a changed WORKDIR, or dotnet run from source) makes every ciphertext unreadable. The database initializer creates the first key under a transaction-scoped advisory lock, before any replica loads its key ring. Serving replicas repeat the check when migrations are disabled, so an expired or revoked-only ring converges before requests are served.

The data-protection layout has these consequences:

  • A purpose string is part of the data format. Changing one invalidates every existing ciphertext under it. Calling SetApplicationName would replace the outer purpose and is ruled out for the same reason.
  • An at-rest key is never derived from the token signing key. The two rotate on different cadences, and rotating the signing key would destroy every stored secret.
  • The per-plugin protector purpose embeds the plugin type and instance id, so one instance cannot unwrap another's blob.
  • Key generation stays automatic on every replica. Disabling it on the replicas that do not migrate would stop the rollover that keeps a key available across expiry.

Wrapping the key ring with an external KEK

Set DataProtection__Kek_FILE to a file containing a base64-encoded 32-byte key, or set DataProtection__Kek_REF to a reference in a configured Vault KV v2 provider. The key ring remains in PostgreSQL; AES-GCM protects each data-protection master key and records the KEK source identity and provider version used. On startup Reeve takes the key-ring advisory lock, locks the stored rows and wraps plaintext keys in one transaction. It unwraps every new value and compares it with the source before commit. A KEK version change rewraps existing values in the same way; key ids and protected application data do not change. For a file rotation, provide the old key in DataProtection__KekPrevious_FILE during the restart that adopts the new Kek_FILE value. Keep it mounted until every pod using the old current file has been drained and restarted with the new one.

Startup verifies that each persisted non-revoked key is readable before data protection can create a replacement. This refusal also applies when no KEK is configured; restore the readable key ring and any required KEK before restarting.

Keep old Vault versions available until every replica has completed the rotation. A wrapped ring without its matching key version stops startup; Reeve does not create a replacement ring key or fall back to plaintext. Restore the matching KEK source and version, then restart. A database backup taken before the first wrap still pairs plaintext keys with that backup's ciphertexts, so delete those backups or rotate the secrets they contain. Wrapping the live ring does not protect old copies.

Operator-supplied secrets

A secret the operator supplies through configuration has exactly one source: the plain value X, a file X_FILE, or a secret-provider reference X_REF. Several configuration layers setting the same secret in different forms is a conflict, not an override.

Secrets that are never stored

A device-onboarding session does not persist its provider context. A Thread dataset in that context embeds the network key, so the context is not even a parameter of the session store: the commission asks the live provider again (IDeviceOnboardingProvider.GetContextAsync) and never reads it back from the row. A provider's GetContextAsync must therefore be idempotent and side-effect-free: read the current dataset, never mint or rotate one. The setup passcode is passed to providers transiently and is never logged or stored. The key is served to the phone by GET /api/onboarding/offers, which is what it is for; that route is session-only, requires devices.onboard, and is excluded from response compression.

Secret references

A reference names a secret held by an external provider instead of storing it: ref:<provider>:<path>#<key>[@<version>]. Binding a reference, to a plugin field, a workload parameter or a workflow header, needs secrets.bind of the saving user, a configured provider and a path inside the provider's allowed prefixes. Removing a reference needs secrets.bind too, so the authority over secret attachments and their audit trail stay inside one permission boundary. A refusal is a bad request (400) that names the reason by kind and never echoes the reference, in the answer or the log, since a pasted secret can sit where a path should. A config flow's OAuth client secret reference that the provider refuses or cannot find is the same bad request; an unreachable provider is a server error, and the OAuth callback names only the kind.

With SecretReferences:RequireReferences on and a provider configured, a value that would be stored protected is refused and only a reference passes.

Refresh and rotation. One replica per kind owns refreshing references. It runs passes on an interval and on request, and the first pass runs immediately, so a request lost in a hand-over waits for the new owner rather than an interval. A pass that loses ownership midway reports failure, and a failed pass is logged and retried by the next. When a rotation needs a restart, the cache already holds the new value, and the restart is claimed under a lock so concurrent passes do not restart the same rotation twice. A workload password is rebound only when its freshly resolved reference matches the stored literal. A replica that never completes its startup scan holds the cluster reference alert open until it restarts. A Vault token session retries a refused or dead token-file value after a 15-second cooldown.

A reference that does not resolve fails the consumer and is audited once per episode as secrets.resolve_failed. Revealing a stored secret value to a user needs a step-up proof with the reveal_secret purpose (see authentication), and the audit records the field location, never the value.

Secret headers of workflow nodes

An HttpRequest node's Headers can hold a credential. The workflow library classifies, protects, masks and reveals through Reeve's WorkflowSecretCodec, which keeps these forms:

Form Stored as Revealed by
Protected enc: plus data-protection ciphertext under the purpose Reeve.Automations.WorkflowSecrets.v1, sub-purpose the workflow id the key ring, for that workflow only
Reference ref:<provider>:<path>#<key>[@<version>] the cached secret resolver, at run time
Plaintext as written nothing to reveal
  • The workflow id is part of the key. An enc: value copied into another workflow, by hand or by editing a stored version, does not open there: the node fails with secret-unresolved and sends nothing. The save refuses it before that (secret-value-unmatched): a protected value is accepted only when it equals the entry already stored at the same place. Asking the codec to protect an enc: value protects that text; it never passes it through.
  • A definition that crosses to another workflow carries no protected value. Every export (single, bundle, script or plugin read) shows *** for a protected value and a reference as written. An import, a bundle import, a blueprint install and a marketplace rollback leave out a *** and any protected value, and a reference the importing user may not bind or a credential-named value the policy will not protect, and name each in droppedSecrets (workflow, node, input, header name, reason; never a value). The one refusal that remains is a header name that is no HTTP field name, which may itself be a pasted secret (secret-input-key-invalid, answered as a definition that does not compile).
  • References follow the plugin-field rule above. Reeve writes secrets.bind and secrets.unbind rows against the workflow, holding the reference and never a value, after a create, an update, an import, a rollback or a blueprint update or repair has committed, and never for one that was refused. A blueprint update or repair is an edit by the user who runs it over the version it replaces: a template that brings a ref: the workflow did not hold needs that user's secrets.bind, otherwise the update is refused (secret-refused) and nothing changes. A blueprint that carries a credential-named header in clear is protected again with fresh ciphertext on every update. A re-render discards an unpublished draft without checking or auditing the references only that draft held. An auto-publish save, or a rollback, that commits and then fails leaves the references it bound without an audit row.
  • SecretReferences:RequireReferences applies when a provider is configured: a header cannot be protected, so a save that would store enc: is refused (secret-refused) while a reference passes. An enc: value already stored keeps working; a header in clear under a credential name is protected on its next save, so with the policy on that save is refused until the header holds a reference. A refusal answers 400 with the library's reason in the problem body's detail and its refusal code in code.
  • A reveal is registered under its place, workflow:<id>:<canvas path>:<node>:<header>, in the known-secret registry that masks logs and spans, so a rotated value replaces the old one instead of accumulating with every run. Neither a value nor a ciphertext reaches a log line, an audit row or an exception message; errors are reported by kind, never by exception text.
  • Who may edit a workflow may redirect its secrets. Keeping *** while changing the node's Url sends the stored secret to the new address, and editing the workflow needs no secrets.bind. Repointing a node that holds a secret does not need secrets.bind. Grant workflow editing only to users you trust with every credential the workflow holds. The outbound request still passes the egress guard.
  • Stored text is not rewritten. A header saved in clear stays in clear until its next save, and older versions keep the text they were saved with; let version retention prune them, or delete and re-create the workflow.

Marking a field sensitive

Instance-recorded sensitive field names add to the current plugin schema's sensitive fields. This keeps schema-declared secrets encrypted and masked when an instance record omits them, including after import from an older plugin version. Blank or whitespace-only names are discarded. The record only grows: a config flow's Finish, whether it creates the instance or updates it as an options flow, adds the fields its own steps mark sensitive.

Sensitive answers arriving over HTTP deserialise as JSON elements, not strings, so a value is string check silently skips encryption. Handle the string kind, the null kind, and everything else through a distinct marked envelope.

Secrets in responses are never compressed

A compressed response that holds a secret next to input an attacker can influence leaks the secret through its length (BREACH): the attacker varies the input and watches the size drop when a guess matches. So the backend compresses JSON (Brotli, gzip) only where no secret can be in the body (constraint). A response is compressed when all of these hold:

  1. the method is GET or HEAD: every endpoint that mints or echoes a secret (sign-in, second-factor enrolment, step-up, token creation and rotation, pairing-window opening, plugin flows) is a write and is excluded without being marked;
  2. the endpoint is a host controller action: plugin-registered routes, the WASM plugin proxy, the workflow library's minimal APIs, SignalR hubs and unmatched requests are excluded;
  3. the path is not under /api/auth;
  4. neither the action nor its controller carries [NoResponseCompression];
  5. the client accepts br or gzip, the content type is application/json or application/problem+json, and the body is not already encoded: streams, media, HTML and file downloads stay as they are.

A GET that can return a secret carries [NoResponseCompression], on the action, or on the controller when most of its reads do. A secret here is anything that grants access or pairs a device: tokens and token-bearing URLs, keys, pairing codes and QR payloads, network credentials, raw configuration documents, echoed request headers, log text and plugin-authored content the host does not redact. That covers the credential, step-up and token controllers, device onboarding offers (Thread network key), the Matter bridge status (pairing code), webhooks and automations (webhook ids), workload artifacts and logs, plugin views and diagnostics, and the development diagnostics and test controllers. When in doubt, mark it: an uncompressed response costs bytes, a compressed secret costs the secret.

Proxies must not add compression of their own. The Compose front end turns gzip off for /api/ and /hubs/; ingress-nginx compresses nothing unless use-gzip or enable-brotli is set, and neither may be enabled for the API paths. A proxy never re-compresses a body that already carries Content-Encoding.

The audit trail

Privileged mutations write structured audit rows. The set covers user and role administration, plugin install, configuration and uninstall, workflow version rollback, binding and unbinding a secret reference (plugin field, workload parameter or workflow header), repository credentials, egress allowlist changes, password self-service change, token issue and revocation, workload token mint, rotation and revocation, every second-factor lifecycle event, stored-secret reveals, and identity-provider role syncs that actually changed the role set. Audit:RetentionDays sets the retention: 365 days by default, 1 to 3650.

The log records changes and failures, not activity. Reads and searches, routine sync or verification passes that found nothing, and the workflow engine's run lifecycle (started, completed, cancelled, skipped, queued, suspended, resumed) write no row; a failed run (workflow.execution.failed) does. A login attempt is recorded by the authentication service; a refusal because local sign-in is disabled is recorded by the login controller instead (in safe mode, in addition to the service's auth.login.safe_mode_refused). A failed attempt for an unknown name records the name that was tried, never the password. Workload-token entries are written only on an actual transition. The Audit Log page offers its filters from what the log contains (GET /api/admin/audit/facets) and shows the acting user's name.

Any operation that changes what an account can do, or how it signs in, must write its audit row in the same save as the change (constraint). Otherwise the trail can describe a demotion that rolled back, or miss one that committed. Where an audit write is best-effort, as on a workload handshake, its failure never blocks the response.

What must never appear in an audit row or a log line

  • Plaintext secrets of any kind. Credential events record the credential identifier only.
  • Challenge tokens, raw credential ids, session ids, raw workload tokens and their hashes, setup passcodes, pairing codes and private keys, in any form. Use a short non-reversible fingerprint if a correlation handle is needed.
  • The specific missing permission code on a denial. That goes to the server log; the client receives one stable generic message.

The trail is detection, not prevention

Audit rows carry no append-only constraint and no hash chain. Write access to the database can rewrite history undetectably. This is an accepted, documented limitation: the trail is evidence for an operator investigating an incident, not a tamper-proof ledger. See known limitations.

The audit export writes its attachment headers before the permission check, so a denied export arrives as a downloadable file containing the refusal rather than as a plain error, and a mid-stream failure leaves a truncated response that looks complete. Check the file, not just the download.

Bootstrap secrets

A signing key and an initial administrator password are required before first start. The backend checks the signing keys for presence and a minimum length of 32 characters, and the password for presence only; there is no weak-value blocklist. No example values ship, so choose strong ones (deploy/scripts/bootstrap-secrets.sh generates them). The bootstrap administrator's credential is flagged must-change; the first sign-in issues a short-lived, single-purpose change token instead of a session.

Backup

There is no in-application backup action: it would need database credentials in the process and could not be atomic. Database backup is delegated to PostgreSQL-native tooling, described in backup and restore. A backup carries the key ring with the ciphertexts it protects, so protect it as you protect the secrets. Moving an installation to new hardware is the same database backup, restored on the new host.