Security
Steady stores business processes: who was invited, what was approved, what an API returned. This page lists the threats Steady is designed against, the control for each, and what remains your responsibility. To report a vulnerability, follow SECURITY.md.
Threat model
| Threat | Control |
|---|---|
| A tenant reads or changes another tenant’s runs | Tenant isolation in every statement; optional row-level security |
| A caller starts flows or sends signals it should not | Flow registry; no network surface, your handler authenticates |
| SQL injection through names, keys or payloads | Parameterised SQL only |
| A hostile payload exhausts storage or CPU | Payload limits and caps that fail closed |
| Secrets leak through stored inputs, results, errors or logs | Redaction, error hygiene, encryption at rest, sensitive steps |
| A stale or forged runner writes results for a run it no longer owns | Lease integrity |
| The audit trail is rewritten | Append-only step log |
| Changed code silently reuses a result for another step | Determinism guard |
| A dependency is compromised | Supply chain |
Tenant isolation
- Every row of the four tables carries
tenant, and every SQL statement Steady sends filters on it (a test asserts that each statement references the tenant). - An instance serves exactly one tenant. A call that names another tenant throws
TenantAccessError; there is no per-call override. - Serving every tenant needs both
tenant: "*"andallowCrossTenant: trueat construction. Such an instance must name the tenant on every write. Use it for administration only. - Defense in depth:
sql/rls.sqlenables row-level security keyed by the connection settingsteady.tenant, so even a bug in the query layer cannot cross tenants on a connection scoped to one tenant. An unscoped connection sees no rows. See Operations.
Flow registry and validation
- Only flows registered on the instance with
defineFlowcan be started, scheduled or signalled by flow and key. Any other name throwsFlowDefinitionErrorbefore the database is touched, so a flow name taken from a request cannot start arbitrary work. - Flow and signal names must match
^[a-z0-9][a-z0-9._-]{0,63}$. Keys, once keys, schedule keys, step names, run ids and tenants are limited to 200 characters. Invalid values throwValidationErrorand nothing is stored.
Signals and starts are server-side
Steady has no HTTP endpoint, no listener and no network surface of its own. Whoever can call
start, signal, cancel or retryNow in your process can drive runs, so:
- Authenticate the caller in your handler (session, API key, or an HMAC-signed link verified with a constant-time comparison) and check that this caller may act on this run.
- Build payloads from verified values. Do not pass a request body straight into
startorsignal, and do not let a request choose the flow name or the tenant. - Protect the route that calls
tick()(for example with the cron secret your platform provides).
The approval recipe shows the pattern.
Parameterised SQL
All values are bound parameters ($1, $2, …); identifiers are constants in the source. JSON is
sent as text and cast in SQL. A static test fails the build if a SQL template literal with ${
appears in the source or in the compiled output.
Payload limits and caps
| What | Limit | Over the limit |
|---|---|---|
| Run and schedule input | 64 KB | PayloadTooLargeError, nothing stored |
| Step result, flow output | 64 KB | the step (or run) fails without retry; the value is not stored |
| Signal payload | 16 KB | PayloadTooLargeError, nothing stored |
| Log line | 1 KB | PayloadTooLargeError thrown by f.log |
| Operations per run | 10,000 | the run fails (LimitExceededError) |
| Log lines per run | 10,000 | the run fails (LimitExceededError, raised by the engine: a flow that catches errors cannot log past it) |
| Unconsumed signals per run | 1,000 | signal() throws LimitExceededError, nothing stored |
Limits are checked in the core and again in the store before writing. With encryption on, sizes
count the plaintext, so encryption does not change what fits. Concurrent signal() calls can
exceed the buffered-signal cap by at most the number of callers racing at that moment.
Redaction
By default, Steady replaces with "[redacted]" the value of a property whose name is, or ends
with, one of these words: password, passwd, secret, token, api key, private key,
authorization, cookie or credential (singular or plural). This applies at any depth in run
and schedule inputs, step results, flow outputs and signal payloads. Names are split into words at
camelCase humps and at separators before matching (clientSecret becomes client_secret), and
only the final word or words count.
| Name | Redacted | Why |
|---|---|---|
password, token, cookie, credentials, Authorization |
yes | the name is a secret word |
clientSecret, accessToken, refresh_token, X-Api-Key, apikey, privateKey, set-cookie, dbCredentials |
yes | the final word is a secret word |
passwordHash, secretName, apiKeyId, credentialBlob |
yes | the name starts with a secret word (the attribute of a secret) |
tokenExpiresAt, tokenUsage, cookiePolicy |
no | token and cookie only count as the final word |
tokens, tokenCount, token_count, inputTokens, outputTokens, maxTokens, max_tokens |
no | allow-listed: model usage counts stay numbers |
cookieConsent, passwordResetRequired |
no | allow-listed: flags that only name a secret |
passengers, passport, keyword, dateKey, idempotencyKey, turkeyHotels, secretary |
no | no secret word |
The allow-list (DEFAULT_REDACT_ALLOW) applies to the final words of a name, so any name ending
in tokens is kept, accessTokens included. Give a list of real tokens a name the default
catches, a custom pattern, or a sensitive step.
In free text (error messages and log lines) it masks name=value, name: value and
"name":"value" pairs with a secret-looking name, and Bearer ... and Basic ... credentials.
This happens before anything is stored or emitted to onEvent, and the flow receives the
redacted value as well, so the first run and every replay see the same data. Be aware:
- A step that returns
{ token: "abc" }gives the flow{ token: "[redacted]" }. Pass references to secrets (a vault path, a record id) and resolve them inside the step that needs them, or use a sensitive step. - The default matches secret words at the start or the end of a name only, so a secret under
another name (
pwd,auth,iban) is not caught. Add patterns withredact: { patterns: [...DEFAULT_REDACT_PATTERNS, /^pwd$/i] }(the option replaces the default list; each pattern is tested against the name as written and against its normalizedsnake_caseform), or turn redaction off withredact: falseif you accept the risk. Text redaction can mask the word after a secret-looking error name (TokenError: ...). - Until 0.1.0 the default was the substring pattern
/pass|secret|token|key|authorization/i, which also rewrotepassengers,keywordandturkeyHotels. If you relied on that breadth, pass it aspatterns. - Redaction works on property names and recognisable patterns. A secret in a field called
noteis not detected.
Errors
Steady stores an error as Name: message, redacted and capped at 1 KB. Stack traces are never
stored or emitted (a static test checks that the source never reads .stack).
Encryption at rest
createSteady({ encryption: { key } }) with a 32-byte base64 key (openssl rand -base64 32)
encrypts, with AES-256-GCM:
- run inputs and outputs, step results (including the records of sleeps, waits and log lines), signal payloads and schedule inputs;
- with a fresh random 96-bit IV per value, and associated data that binds each ciphertext to its row and column, so a value copied into another run or column fails to decrypt.
The key is never stored. A database dump or a read replica then exposes no payloads.
Not encrypted: tenant, flow names, keys, step and signal names, statuses, timestamps and error texts (errors are redacted). Do not put secrets or personal data in keys and names.
Integrity: GCM tags must be the full 16 bytes and IVs exactly 12 bytes; anything else fails to
decrypt. With a key configured, a stored value that is not an encrypted envelope is refused with
DecryptionError as well, so someone with write access to the database cannot replace a step
result or an input with plaintext of their choice and steer the flow. (A run output that is SQL
NULL, as it is until the run completes, is read as null.)
Operational rules:
- Reading an encrypted row without the key, or with a different key, throws
DecryptionError; Steady never hands ciphertext to a flow. GCM cannot tell a wrong key from altered data, so during a tick such a run is by default released for 5 minutes with its attempts untouched (outcomedeferred, reported in the tick’serrors) and the other runs carry on; one runner with a missing or wrong key cannot dead-letter in-flight runs. After 24 hours of failed decryption the run fails.createSteady({ onDecryptionError: "fail" })fails it at once instead. - A due schedule that cannot be decrypted is reported in the tick’s
errorswith its key and id (schedule "<key>" (<id>): DecryptionError: ...); the other schedules still fire. - Turning encryption on for a database that already holds plaintext Steady rows: set
encryption: { key, allowPlaintext: true }(migration mode), then- call
steady.schedule(...)again for every schedule, with its key, cron and input: schedules never finish on their own, and re-registering rewrites the row encrypted (a schedule this instance cannot decrypt is treated as absent and replaced); - wait until every run started before the switch has finished;
- remove
allowPlaintext. In migration mode plaintext rows are trusted as they are, so keep the window short. A plaintext schedule left behind stops firing (reported inerrors) onceallowPlaintextis removed; callschedule()for it again to repair it.
- call
- Every runner and every process that reads runs needs the same key.
- Key rotation is not supported in 0.1. Losing the key makes encrypted rows unreadable.
Sensitive step results
f.step(name, fn, { sensitive: true }) is for a result the flow must use later and that must not
be redacted, such as an access token or a signed link:
- The result is stored only encrypted and is not redacted; the flow gets the real value on the first run and on replay.
history()(its timeline and its step rows) andonEventshow"[sensitive]"in its place.- It requires
encryption. Without a key, the step body does not run, nothing is stored and the run fails withEncryptionRequiredError; the store layer also refuses such a value as a second line of defense. Configure a key, thenretryNow(runId).
Everything else in the flow is unchanged: if you return the secret as the flow output or pass it to
f.log, it is redacted there as usual. See the recipe.
The store is internal
A Steady instance does not expose its store: the store returns sensitive step results decrypted
and unmasked. Sensitive values reach only the flow that recorded them; get, list, history
and onEvent never show them.
Lease integrity
Each instance has a random lease owner id (steady-<uuid>). Every write a runner makes (journal
entries, parks, completion, heartbeats) is conditional on lease_owner being that id and the lease
not having expired, in the same statement. A runner that was paused, lost its lease and wakes up
later cannot record anything; a test proves that the late write of a stale runner is rejected and
only the new owner’s row exists. Lease expiry uses the runner’s clock: keep hosts on NTP.
Append-only step log
The library never updates or deletes steady_steps rows. With sql/rls.sql installed, a trigger
refuses UPDATE and DELETE on that table for every role, the owner included. Retention has to
switch it off explicitly in a transaction, as the table owner (see
Operations). ALTER TABLE ... DISABLE TRIGGER takes an ACCESS EXCLUSIVE
lock on steady_steps until that transaction ends, which blocks every runner; run retention in a
maintenance window.
Determinism guard
On replay, each operation’s name is compared with the journal entry at its position. A mismatch,
or a flow that returns before replaying its journal, fails the run with ReplayMismatchError
instead of handing one step’s recorded result to another.
Supply chain
- Zero runtime dependencies. Database drivers and
drizzle-ormare optional peer dependencies, never bundled; the adapters only call methods on the object you pass. - Fuzz tests (fast-check, a development dependency only) on the cron and duration parsers, size limits, summaries, redaction and encryption.
- CI runs
pnpm audit --prod --audit-level highon an isolated install of the packed package.
Your responsibilities
- Authenticate and authorize every call that starts, signals, cancels or retries runs.
- Make step bodies idempotent: a body can run again after a crash.
- Protect the database credentials and the encryption key; use the
steady_approle for the application. - Choose retention that fits your data protection rules (see Operations).