Hardening Guide¶
Checklist for deploying wf on production and critical infrastructure.
File System¶
-
Restrict the workflows directory — only the user running
wfshould have write access. Other users should not be able to add or modify workflow files. -
Verify database permissions — the SQLite file should be
0600. -
Verify log directory permissions — log directories should be
0700, log files0600. -
Do not run wf as root — there is no need. Running as root widens the blast radius of any task that misbehaves.
Workflow Files¶
-
Review all TOML files before running —
cmdstrings are executed by the shell. Treat workflow files like code: review them before running, and store them in git. -
Use
clean_env = truefor sensitive tasks — prevents secrets from the parent process environment leaking into task subprocesses. -
Avoid echoing secrets — registered variable values (captured via
register) are stored in the SQLite database. Do not register secrets as variables. -
Use
timeouton every task in production — an unbounded task can block a workflow indefinitely. Set a realistic upper bound on every task. -
Run
wf validatein CI — add a CI step that validates all workflow files on every commit. Catches broken workflows before they reach production.
Variables and Interpolation¶
-
Do not use
--varto pass secrets from the shell — variables passed via--varare stored in the database. Use environment variables inenvblocks for sensitive values, not--var. -
Understand that
registercaptures the last stdout line — if a task's script outputs a secret as its last line (e.g., for a token exchange), that secret is stored in the database snapshot. Design scripts to avoid this.
Database¶
-
Back up the database regularly — the database is the source of truth for all run history and variable snapshots. Losing it means losing all history and the ability to resume failed runs.
-
Do not share the database between users — the database contains run output, registered variables, and forensic logs. Keep it user-local.
Execution Environment¶
-
Pin
wfto a specific version in production — use a specific git tag or commit. Avoid building fromHEADon production machines without review. -
Use
retriesconservatively on tasks with side effects — if a task withretries = 3partially completes before failing, each retry may duplicate its side effects. Design idempotent scripts. -
Set
--timeoutat the run level for production runs — even if individual tasks have timeouts, a run-level timeout prevents a pathological case where many retried tasks accumulate.
Multi-User Environments¶
-
Isolate workflows per user — each user should have their own
WF_PATHS_WORKFLOWSdirectory,WF_PATHS_DATABASE, andWF_PATHS_LOGS. Do not share these between users. -
Use separate service accounts for production workflows — create a dedicated OS user (
wf-prod) with minimal permissions. Run production workflows under that account.
CI/CD Integration¶
-
Validate before deploy — add
wf validateto your CI pipeline to catch workflow errors before they reach production. -
Export run records for compliance — use
wf export --format tarto archive run records for audit purposes. -
Monitor the health endpoint — run
wf healthin your monitoring system or as a cron job to detect stale runs and disk pressure early.
What wf Does Not Do¶
These are intentional limitations — understanding them helps you design secure deployments:
wfdoes not sandbox task processes. Tasks run with the same OS-level permissions as thewfprocess itself. If you need sandboxing, run tasks inside Docker containers or withsystemd-run --property=....wfdoes not encrypt the database. Sensitive values registered viaregisterare stored in plaintext. Use full-disk encryption (LUKS,FileVault,BitLocker) if the database host needs to be protected at rest.wfdoes not authenticate CLI users. Anyone with access to the binary and the workflows directory can run workflows. Use OS-level access controls.wfdoes not enforce network policies. Tasks can make arbitrary network connections. Use OS-level network namespaces ornftables/iptablesrules if network isolation is required.