Skip to content

Security: clement-tourriere/devflow

Security

SECURITY.md

Security Policy

Supported versions

Version Supported
1.x Yes
0.x No. Upgrade using docs/MIGRATING.md.

Reporting a vulnerability

Report vulnerabilities privately:

  1. Do not open a public GitHub issue.
  2. Email clement.tourriere@gmail.com with the subject "devflow security".
  3. Include a description, steps to reproduce, the potential impact, and a suggested fix if you have one.

You should receive an acknowledgment within 48 hours. The goal is a fix within 7 days of a confirmed vulnerability.

Security model

Hooks, environment and trust

  • [hooks] commands (setup, switch, teardown) are shell commands run with sh -c in the worktree. They can do anything your user can.
  • devflow acts only on content you approved. Trust is the SHA-256 of a versioned scope (version 2), stored per project checkout in trust.toml with the version it was made under. The scope is: every hook command with its name and effective timeout (after merging devflow.local.toml); the [env] presets and recipe templates, as written (never a generated value or password); and the pitchfork configuration of the project directory, pitchfork.toml and .config/pitchfork.toml with their .local.toml overlays, every field of every daemon (command, dir, env, hooks, cron, watch, boot_start, auto, depends, ready_*, …). Any change to any part needs approval again. Review what devflow trust shows.
  • The approval is kept per project and main checkout, but the digest it holds is compared with the scope of the workspace a command acts on: the project's configuration is read from the main checkout, the pitchfork files from that workspace's own directory. Approving the main checkout therefore does not approve a linked worktree whose pitchfork files differ, and setup, switch and teardown hooks and [env] recipes in that worktree wait for devflow trust run inside it (one approval per project and main checkout means the latest approval is the one on record). An approval stores the digest that was reviewed and nothing recomputed: a file replaced after the check leaves an approval of what was shown, which then no longer matches.
  • A version 1 approval (hooks only) never authorizes version 2 content: it reads as untrusted with format_changed. A project with no hook, no [env] and no pitchfork configuration has nothing to approve.
  • pitchfork files are read read-only (regular files only). At most 1 MiB of a file is parsed; a larger file is not parsed but hashed whole, as a stream, so a change anywhere in it is a change to the scope. A file above 256 MiB cannot be bound to an approval, so the scope is never reported as trusted and approving it is refused. Every component of a file's path is checked for links, a directory link included (.config -> /elsewhere): a link is followed only inside the project, and one that leaves it is reported and bound by its hash, never shown. A file that cannot be parsed is covered by its hash, and parse errors never quote the file. Only the project directory is read: pitchfork's own user and system configuration and the files of parent directories belong to the user.
  • Autonomous triggers. cron, watch, boot_start and auto make pitchfork start a daemon on its own, as soon as a supervisor sees the worktree, with or without devflow. devflow trust and the GUI dialog flag every such daemon explicitly. Approving the scope states that you accept those commands; it does not stop pitchfork from running configuration you did not approve when you run pitchfork directly (see the plan, D4).
  • Which daemons a command reaches. devflow starts and stops exactly the fully qualified namespace/name ids of one workspace's own daemons. It never uses pitchfork's --local, --all or --global, which select daemons by scope (--local takes those of every configuration from the working directory up to the root, so a worktree inside another project would act on that project's daemons), and it refuses to start a daemon whose depends names anything outside the workspace's own pitchfork files, because pitchfork starts dependencies by itself. A workspace is attributed daemons only through the namespace its receipt assigned (df-<project8>-<instance8>), never through a namespace a file declares: the files must give that same namespace before devflow shows, starts or stops anything, and otherwise the operation is refused (foreign_namespace; --force does not override it, and a forced removal leaves the daemons running). Only the namespace and worktree_label that devflow generated are left out of the trust digest, so a file edited to name another workspace's namespace is also unapproved. A start or stop is also verified against the namespace it acted in, read from the raw pitchfork list --json and not through the files as they are afterwards: a file pointed at another workspace's namespace while pitchfork stop runs would otherwise make the daemon that still runs under the assigned one vanish from the report and let a removal go on over it, so a daemon of the captured namespace that still runs, or an attribution that changed during the operation, makes the report not ok. The dependencies judged are those of a daemon's highest-priority definition (pitchfork replaces a daemon defined in several files whole); every layer stays in the approved scope.
  • Unknown is not nothing. A pitchfork state devflow cannot read (the listing fails or is over the output budget, a pitchfork on PATH that does not run, as a mise shim without a version, or lacks a feature devflow calls) is never taken for "nothing runs": starts and stops are refused (state_unknown, or not_installed when pitchfork cannot be used at all), and so is the removal of a workspace that has pitchfork files and a namespace, until --force accepts not knowing (which stops nothing it cannot ask and says the daemons may still run). A listing devflow cannot read with confidence is not "nothing runs" either: for a stop or a removal only a daemon in a known stopped state (stopped, errored, failed, available) counts as stopped, and a daemon of the workspace in any other state (unknown, one a later pitchfork adds), with a malformed id, status or pid, or an entry that cannot be read at all, is state_unknown. A supervisor that is down is not "nothing runs" either: pitchfork's daemons survive their supervisor (a SIGKILLed supervisor leaves them running, reproduced against 2.29.0), so devflow records in the receipt, before every start, the daemons it asked pitchfork to start, and clears the record after a stop it read back with the supervisor up. With the supervisor down and a recorded start, removal and down are refused (state_unknown, forceable; pitchfork supervisor start, then devflow down, takes the daemons back and stops them) and a forced removal says the daemons may still be running; with no recorded start they proceed with a warning that processes started outside devflow cannot be checked. A workspace with no pitchfork file and one devflow never set up are not held up. Neither is a machine with no pitchfork on PATH at all: a project that commits a pitchfork.toml must not make everyone without pitchfork pass --force, which also overrides the dirty and unmerged protections. That is an accepted exception, and it is said: when the workspace has devflow's namespace file or a recorded start, the removal result carries the warning "pitchfork isn't on PATH, so devflow couldn't check this workspace's daemons" and stops nothing.
  • Bounded commands. Every command whose answer devflow reads (pitchfork's queries and start/stop, docker compose port, the docker calls of the container services) runs through one runner: its own process group, ended and reaped at the deadline; at most 4 MiB kept per output stream (beyond it the stream is read and dropped, never blocking the command, and the call is flagged truncated, which pitchfork queries, docker compose lookups and docker exec treat as an error rather than parsing a prefix); and a bounded wait for output after the command exits, one wait for both streams, never longer than 500 ms nor than what is left of the timeout. Processes a command left behind holding its pipes are ended with its group (TERM, then KILL) for queries; those of pitchfork start and stop are left alone, because the supervisor that pitchfork start launches can be in its group. A process that escaped the group (setsid) cannot be reached: its reader thread is detached and ends when it lets go of the pipe.
  • Residual risk: the instant before pitchfork reads its files. Approval, namespace and readiness are checked, and the files read again, immediately before every start, stop and removal's stop, and any change since the first look refuses the operation. That includes devflow's own devflow.toml: the Project a caller holds is a snapshot, so the last look reloads it and judges readiness (the receipt against the configuration's generations), the scope and the approval on the configuration as it is then; one that cannot be read then refuses the operation (unreadable). What cannot be closed is the interval between that last look and pitchfork itself reading its configuration (it reads its files on its own, and runs a daemon's lifecycle hooks from them): a process that can write the worktree at that moment can still change what pitchfork runs. devflow's guarantee is about the content it checked a moment before; it is not a sandbox, and pitchfork itself, run directly, acts on whatever the files say.
  • Trust covers the commands, not the scripts they invoke. A trusted bun run db:migrate runs whatever package.json says.
  • [env] recipes and presets put values into the environment of every process that loads .devflow/env, which is a way to run code (NODE_OPTIONS, PATH, BASH_ENV, …). They are therefore applied only for an approved scope (or DEVFLOW_TRUST_HOOKS for one run): otherwise .devflow/env holds only what devflow generates and the workspace is needs_attention. Recipes cannot set what devflow generates or reserves (DEVFLOW_*, PG*, DATABASE_URL, COMPOSE_PROJECT_NAME, and the <NAME>_DATABASE_URL of each scratch database).
  • In --json and --non-interactive modes, and when stdin or stderr is not a terminal, untrusted hooks are skipped and the workspace is marked needs_attention. DEVFLOW_TRUST_HOOKS=1 (or true) trusts for one run; use it only for repositories whose hooks you have read.
  • teardown hooks run on devflow remove and need the same trust: untrusted teardown hooks refuse the removal, and --force removes the workspace without running them.
  • mise can replace the workspace's database. A command that goes through mise (mise exec, mise run, a shim) has mise's [env] applied over the variables devflow gives it: a later _.file, a mise.local.toml, a plain [env] key (or DATABASE_URL = false), a mise.toml in a subdirectory, an environment-specific file selected by MISE_ENV, a task's own env, conf.d or the global configuration can hand a hook the main checkout's DATABASE_URL. A check made at the root of the worktree cannot establish what a command receives, so the defence is by construction: devflow exec -- CMD sets .devflow/env on the environment last and replaces itself with CMD, and what devflow init generates goes through it (mise exec -- devflow exec -- CMD, daemons run = "devflow exec -- CMD"). A daemon counts as wrapped only when its whole run is one simple command, devflow exec [options] -- PROGRAM ARGS (behind NAME=value and exec, redirections allowed), whose program starts no mise: devflow exec -- true; npm run dev starts the app outside the wrapper and devflow exec -- mise exec -- npm run dev (or through env, sudo, sh -c) hands it mise's values after devflow's, so neither skips the check of what mise delivers. The test is conservative about where mise hides: any occurrence of mise as a word in what follows devflow exec -- counts, inside a quoted string for sh -c/bash -c/eval (devflow exec -- sh -c 'env -u X mise exec -- bun run dev'), after a wrapper with options (env -u X, sudo -E, timeout 5, nice -n, nohup, xargs, command, exec, time) or in a path ending in /mise, and a command word that is a shell expansion ($TOOL run) is not followed; anything the scanner does not understand counts as not wrapped and not protected. The same holds for a hook (mise exec -- devflow exec -- mise exec -- CMD, or … -- sh -c 'sudo -E mise …', is an unprotected use of mise). For hooks written by hand, devflow checks at run time, before the first setup hook, from the commands: a hook that runs devflow exec inside mise needs no check of the variables; for any other hook that runs mise it runs mise exec -- sh -c … in the worktree with exactly the environment the hook will get (with a timeout, killing the process group, and capped output) and compares the variables the process sees with .devflow/env's (a different value is overridden, a missing one removed); on either, or a failed check, no hook runs and the workspace is needs_attention. --skip-mise-check runs the hooks anyway and is recorded in the receipt. A hook the check cannot stand for (cd DIR ahead of mise, mise run/mise r/mise tasks run, mise -C/-E, a MISE_* assigned in the command) is not blocked and is named in a warning (its name or index, never its command) recommending devflow exec. A command chosen at run time ($TOOL exec), mise started from a script file or from a program's own code, and one that reaches mise through a shim, is not seen, except that a variable in command position after devflow exec -- makes the daemon not wrapped. Only variable names and file paths are ever logged or returned: no value, and nothing mise prints on failure (a parse error can quote a line); devflow exec prints no value either and starts nothing without the workspace's file. _.source scripts that mise runs while resolving belong to the trusted configuration.
  • mise trusts a configuration on its own. With mise 2026.10, mise exec and mise run record the directory as trusted and run the configuration (_.file, _.source, templates) when they have no terminal, where mise env refuses: a hook that runs mise in a worktree whose configuration nobody reviewed would trust it silently. devflow therefore asks mise env (which trusts nothing) before the first hook whenever a setup hook runs mise at all, devflow exec inside it or not, and stops with mise trust PATH named when mise refuses. devflow never runs mise trust and never edits mise's settings; devflow doctor prints the choices and runs neither: mise trust PATH for one file, or mise settings add trusted_config_paths DIR for the worktree directory, which trusts every mise configuration file that will ever appear under it, in every worktree anyone creates there. What a hook the check cannot stand for runs in another directory is mise's own business: its mise exec there trusts what it reads. devflow init therefore proposes no mise trust hook: it cannot run before the worktree is stopped.
  • Replacing a configuration file needs an atomic exchange to be airtight. devflow init --apply replaces each file by exchanging a staged copy with it (renamex_np on APFS, renameat2(RENAME_EXCHANGE) on Linux filesystems that support it) and comparing what was displaced with what the plan read: a save that lands in that window is put back or kept next to the file, never lost. Where no exchange exists (other filesystems), a narrow window remains between checking that the file is unchanged and renaming over it, in which a save by rename can be overwritten; the file is hard-linked to a backup before the replacement and the backup is kept when an in-place edit shows in it, but a save by rename in the last instant is not recoverable. On such a filesystem, do not save the files --apply is writing while it runs.
  • devflow is not a sandbox. Use your agent harness, containers or VMs when you need hard isolation.

Database isolation

  • Each project has one PostgreSQL 18 server. The admin (provisioner) role owns every devflow database and the devflow metadata database; it can read and change everything in the project. Never give it to a sandbox.
  • Objects in all branch and snapshot databases of a project belong to one NOLOGIN project owner role. Each branch has its own LOGIN role that can connect to its own database only. A branch role cannot connect to sibling branches or snapshots of the same or another project. The login is a SET-only member of the owner (INHERIT FALSE) and SET roles to it at login, so sessions act as the owner; the owner holds CONNECT on the branch's own databases (and nothing else) so that functions that check it for the current user, such as pg_database_size(current_database()), work inside a branch. The owner is shared, which is why no login may inherit it: the connection check is made for the login before SET role applies, and a login that inherited the owner would inherit its CONNECT on every sibling. A consequence: a session can read the size of a sibling's database (pg_database_size('<name>'), a generated name), never connect to it. Branches made by an earlier build are converged by the next operation on the project (devflow db reconcile, or any create, reset or drop): logins stop inheriting first, then the owner is granted CONNECT.
  • New databases are created closed (ALLOW_CONNECTIONS false), have their ACLs normalized, and are opened to the branch login last. The devflow metadata database is closed the same way. Snapshots are not templates, so only the admin can clone them.
  • Logins and owners have no elevated attributes (no superuser, CREATEDB, CREATEROLE, replication or BYPASSRLS) and no ADMIN OPTION. A session acting as the owner cannot cancel or terminate a sibling branch's sessions.
  • Scratch databases (extra_databases: the test and shadow databases of a branch) do not change this model. Each is created empty by the same closed-creation protocol as a branch database (closed, PUBLIC revoked, the owner role granted CREATE, TEMPORARY, opened, CONNECT granted last to the login and the owner), owned by the admin, and open to that branch's login only: a sibling's login cannot reach it, and the login keeps NOCREATEDB, so tools use the database they are given instead of creating one. They are separate databases recorded by identity in the metadata database, so no clone, snapshot or REASSIGN OWNED ever reaches them; the login is the branch's own, so rotating its password covers them and its URLs are as secret as DATABASE_URL. A name removed from the configuration leaves the database in place as a recorded orphan; it stays reachable only by that login and is dropped only on request.
  • On an external server devflow changes only databases it created. Restricting access to every other database on that server (pg_hba.conf, or revoking PUBLIC CONNECT) is the operator's responsibility. A managed server revokes PUBLIC CONNECT on postgres and template1.
  • Replication machinery (subscriptions, background workers) is outside the cloning contract.
  • Roles that cannot be dropped are disabled (NOLOGIN, no password) and recorded for cleanup.
  • Branch roles can use the server's resources (connections, disk, CPU). devflow adds no quotas in 1.0.
  • Database and role names are generated; devflow never derives ownership from a name.

Container services (Valkey, Redis and MySQL)

  • Every branch is a container of its own with its own --requirepass, generated at creation and never inherited: an RDB file carries data, not credentials, so a clone cannot answer to its source's password, and the source cannot be opened with the clone's. The password is on the command line the container starts with, so the server never listens without it; the trade-off is that anyone who can run docker inspect (root-equivalent on the Docker engine) reads it, and that the host's process list shows the docker create command line for the instant it runs. Do not use the services on a machine with untrusted local users, and do not hand a sandbox the Docker socket, context or SSH key.
  • The catalog (<data dir>/services/<project id>.json, mode 0600) holds each branch's password, container id, volume, pinned image digest and port, and the operation journal; the coordinator's per-operation logs under <project id>.logs/ are 0600 and redacted. Ownership comes from the catalog: devflow removes or restarts only the container and volume ids and names it recorded, and only if their dev.devflow.* labels agree with the record: the project, the service and the one branch, snapshot or operation the resource was made for (dev.devflow.branch, dev.devflow.snapshot, dev.devflow.helper). The project's label alone is not enough, so a volume that shares only the project's label (another service's, another branch's, a namesake someone created) is never deleted by a rollback, a reset's cleanup, a drop or a snapshot delete, and is never written into or started on. A resource that does not agree is kept: the operation that wanted to remove it stops there, is not counted as done and stays journaled, and devflow service NAME reconcile lists it as needing an operator until you remove it yourself (if it is not devflow's) and reconcile again. Docker has no conditional delete, so the labels are read just before the removal by name; a replacement created in that instant is not covered. A container that merely has a name devflow chose, or carries a devflow label without a record, is refused and reported, never adopted or removed. The catalog is bound to the Docker daemon id: another daemon's resources are not this project's, and a catalog opened on a different daemon is refused.
  • Each branch is published on 127.0.0.1 only, on a port allocated once from hash(project, service, branch) in 20000–39999 and kept (never moved silently). On OrbStack the container also has an identity-suffixed name, <branch8>.<key>.<project>-<project8>.devflow.orb.local, reachable from containers and from the Mac with the same password. Valkey/Redis speak no TLS here: the loopback binding and the password are the protection.
  • The copy helper runs with no network (--network none), mounts the source volume read-only and exists only for the copy; it is killed and confirmed gone on a deadline or when its coordinator died. The short-lived read-only helper a recovery uses to check a volume is journaled the same way (its name before Docker creates it, its id right after), so a recovery that is killed leaves a helper the next recovery, drop or reset finds and removes, not one that pins the volume forever. A docker create whose client was ended can still be carried out by the daemon later, so every attempt (each has a name of its own) is recorded in the catalog's list of helpers before Docker is asked for it, and the list outlives the operation. Reconcile, a rollback and every volume removal look for the attempts that are not resolved: any docker create client of the name (found with ps) is waited for and ended after a minute, and the container, if it exists, is removed by its id or by the attempt's name when it carries this operation's helper labels. An attempt is resolved (and dropped from the list) only once its container was made, removed and confirmed gone. One whose outcome is unknown is fenced, not waited out: no id came back and nothing has the name, but the daemon may still hold the request and deliver it after any deadline (the late helper would pin the volume, or, once the volume was removed, recreate it empty), so elapsed time is never taken for completion. The cleanup creates a tombstone under the attempt's exact name: a container made from the helper image already present (never pulled), never started, with no mounts, no network and no published port, labelled as a tombstone of the operation (dev.devflow.tombstone, and deliberately not as a helper). A create of that name that arrives later fails with a name conflict before any volume is touched. If the tombstone's own create conflicts because the real helper appeared meanwhile, the real one (it has no client left) is removed by its labels and the tombstone is created again; a namesake that is neither is left alone and the attempt stays unresolved. Sweeps of several processes (two reconciles, a volume removal, a forget) do not interleave on one attempt: each attempt is handled under a lock of its own (<service>-attempt-<name>.lock in the catalog's lock directory), from the inspect and removal of its container through the tombstone to the catalog write, and it is read again under that lock, so a sweep that read it before another resolved it does nothing. A catalog write for an attempt that is no longer listed is not a success: the tombstone made for it is removed. While a forget has marked the service, no other sweep makes a tombstone, so none appears behind the one that is removing them. Tombstones are tiny and the late create has no deadline, so none is removed with time: the attempt stays listed with the tombstone's id, every sweep makes the tombstone again if someone removed it, and forget removes them last, after its other effects and just before it deletes the entry. A create delivered after forget is no longer fenced and can leave an unlabelled empty volume of its own, which no label ties to the project; that window is the cost of leaving no container behind for a service that is gone. Before a branch's or snapshot's volume is removed, the helpers of the list and those that still mount it (this project's, this service's, a helper label) are removed, and while Docker says the volume is in use the sweep and the removal are repeated, a bounded number of times.
  • A Valkey/Redis source with nothing new to save is cloned from its last save, not from a new one. devflow reads INFO persistence first; when rdb_changes_since_last_save is 0, no save is running, rdb_last_bgsave_status is ok and the source volume holds a non-empty dump.rdb, it reflinks that file and asks for no BGSAVE; otherwise it takes the BGSAVE path. The reasoning: the server replaces dump.rdb by an atomic rename of a complete temporary file, so a reflink sees a whole file; with no change since the last save that file is the live dataset; and a write racing the check has the same point-in-time ambiguity a BGSAVE fork already has. The clone records capture_last_save and the server's rdb_last_save_time as its capture time, and capture_exact is cleared if the server saved again while the file was copied. This changes no credential or isolation property: the file is the same kind of data the BGSAVE path copies, it is read from a catalog-recorded, label-checked volume, and the copy helper is the same.
  • devflow service NAME url is the one command that prints a container URL with its password. status, list and every other --json document redact it, and the URL is a secret in .devflow/env, [env] recipes and hook output like DATABASE_URL.
  • A copy reads only a source volume the catalog records: it must exist (a missing volume is never created by being mounted, and never stands for an empty dataset) and carry this project's, this service's and the branch's or snapshot's labels before it is mounted. A snapshot made by a pre-release build has no snapshot label and is not migrated: a copy from it is refused with the command that removes it, and snapshot delete removes it by the catalog's record and the project and service labels (a missing snapshot label is accepted there; another snapshot's never, and neither is a volume that carries a branch or helper label, whose identity is its own). A rollback is recorded (RollingBack) before anything is removed and is resumable, and a completion after a crash first finds the volume the copy produced, whole and ours, or rolls back instead.
  • Recovery runs under the locks and is bounded. Whoever takes the locks of a branch or snapshot (a clone or snapshot coordinator, up, down, a removal) looks again for unfinished operations that touch them: two requests can both pass the check made before locking, and the one that runs second would otherwise run against what a coordinator that died left behind (a stopped source). An abandoned operation is recovered (with the locks released for it) and the locks are taken again, a bounded number of times. A stop is fenced, not waited out. A docker stop is journaled before it is issued, but the daemon can receive it after any deadline and keeps carrying it out when its client is gone, so no elapsed time proves it over. Unless its client was seen to return success, recovery never reuses the container the stop named: it journals the decision, stops the container itself, removes it by its recorded id (labels checked, absence confirmed) and creates a new one from the managed profile on the same volume, name, port and labels, which it health-checks; a late stop names an id that no longer exists. The container's id changes, its data and endpoint do not. An ordinary service down is journaled and fenced the same way. It belongs to no operation, so its stop is recorded in the branch's own catalog record (container id, the time it was asked for, the grace, the caller's pid) before it is issued, and cleared only when the client returns success. If it times out or its caller dies while Docker still holds the request, the record stays; the next up of the branch (and a workspace's setup or switch, which start it through up) stops the container it names itself, removes it by that id, confirms it gone and starts a new one on the same volume, name, port and labels, and the next down removes it instead of issuing a second stop at the same id. A record whose container is already gone is cleared. devflow down and removing a workspace stop no service container with docker stop (a removal deletes the recorded container by id), so they have no stop to fence. Every docker call of the container services goes through one bounded runner (60 seconds for a query, start or removal, a pull 15 minutes, a stop its timeout plus a minute), and a recovery also passes what is left of its own time (20 minutes) to each call; a daemon that does not answer in time, or a log that cannot be read, is unknown (a typed timeout), never "nothing is going on": the recovery stays pending with its journal intact, and a timeout while verifying a copy does not roll the operation back. forget is exclusive per service (a lock file in the catalog's lock directory, held from before its marker is set until the entry is deleted or the marker cleared; a second forget waits half a minute and then reports the service busy), so two of them cannot remove and make tombstones behind each other. It persists a marker that makes planners refuse to record anything for the service, and deletes its entry only after reading it again under the catalog lock and finding nothing it did not remove; a fenced attempt counts as removed only while the catalog still names the very tombstone container (by id, not by the attempt's name) that was removed. Helper-attempt lock files are never unlinked on release (a waiter could keep the old inode); forget, once the entry is gone and while still exclusive, removes the files of the attempts that are no longer listed, which nothing can be waiting to act on. reconcile counts the old container and volume of a reset that is waiting for its cleanup as recorded.
  • Test hooks (DEVFLOW_TEST_LABEL, DEVFLOW_TEST_COPY_DELAY_SECS, DEVFLOW_TEST_COPY_TIMEOUT_SECS, DEVFLOW_TEST_NO_REFLINK, DEVFLOW_TEST_STOP_TIMEOUT_SECS, DEVFLOW_TEST_QUERY_TIMEOUT_SECS, DEVFLOW_TEST_RECOVERY_BUDGET_SECS, DEVFLOW_TEST_CREATE_WAIT_SECS) only add a label, slow the copy down, pretend reflinks are refused, shorten the time a MySQL source has to stop, the bounds on Docker calls and the recovery's time, or the waits for a late helper create; they grant nothing and are meant for the Docker tests.

MySQL (preview)

The MySQL engine follows the rules above and adds these. It is marked preview until its review closes.

  • Accounts. A branch has MySQL's own accounts, root@localhost and one application account, app@%, and nothing else. The root password and the application password are generated per branch (32 alphanumeric characters), never inherited, and kept in the 0600 catalog. root exists only inside the container (there is no root@%), so it cannot be reached through the published port. The application account has all privileges on its one database. A source that has any other account (mysql.user is audited, including roles) is refused by name: it would keep its source's password in the clone. So is one that grants roles (mysql.role_edges, mysql.default_roles) or proxy privileges beyond the default row of root@localhost (mysql.proxies_priv). Nothing of the source's authentication is inherited. The bootstrap sets each managed account's password with caching_sha2_password named, REQUIRE NONE, no password expiry, no failed-login lock-out, PASSWORD REQUIRE CURRENT DEFAULT and ACCOUNT UNLOCK, then DISCARD OLD PASSWORD: a plain ALTER USER … IDENTIFIED BY leaves a secondary password (RETAIN CURRENT PASSWORD) in place, which would still open the clone with a password its source knew. MySQL's own accounts are locked and have their secondary password discarded. The accounts are then read back with the new root password, and the clone is abandoned (bootstrap, nothing promoted) unless every account has no secondary password (User_attributes), the two managed accounts are exactly as set and the others are locked. What still comes from the source is data: the application account's grants on its database, and any other privilege of app or root that the source's own tables held.
  • Where the passwords travel. Never on a command line and never in a container's environment or docker inspect: the container is created with no secret in its arguments or variables. devflow sets and checks passwords with docker exec -i, and the secret is on the standard input of that command: the SQL of the bootstrap (ALTER USER … IDENTIFIED BY '…') and, for the health check, the first line of the input, which a small bash script reads into the mysql client's own environment (MYSQL_PWD) and nowhere else. So ps on the host shows docker exec -i … mysql -u app and no password, and the docker client's environment holds none. What remains: for the milliseconds a mysql client runs, its password is in that process's environment inside the container, readable by root in the container (/proc/<pid>/environ). No password is written to a file in the container. A password is masked in every message devflow builds from the client's output.
  • A clone never listens before its identity is set. The clone's data directory is copied without auto.cnf (so it gets its own server UUID) and without the TLS and RSA key pairs (so it generates its own). A bootstrap container then starts it with --network none, --skip-networking and --skip-grant-tables; the only way in is its local socket through docker exec. There the version is checked (8.4), the accounts audited, new passwords set and both logins proven. It is stopped cleanly and removed before the container with the published port is created. A bootstrap container's id is journaled before it starts, so recovery removes it.
  • A clean stop is verified, not assumed. The source is stopped with docker stop and a generous timeout (5 minutes); the copy proceeds only if the container exited with status 0 and its log since its last start holds InnoDB's shutdown report (Shutdown completed; log sequence number …) and the server's. A server killed after the timeout (status 137) aborts the clone, and the source is started again. A crash-style shutdown is not accepted. innodb_fast_shutdown=2 exits 0 and logs both reports yet leaves a data directory that needs crash recovery, so right before the stop devflow, as root over the socket, resets a persisted entry (RESET PERSIST IF EXISTS innodb_fast_shutdown), sets innodb_fast_shutdown=0 and reads it back, and refuses unless it reads 0. The stop's log must also lack InnoDB's very-fast-shutdown notice (this is what judges a source that was already stopped: one stopped with a fast shutdown of 2 is refused, with the command that starts it again). Two more checks do not rely on the proof: the log of the source's next start, and of the clone's first start in the bootstrap, must not contain Starting crash recovery; either abandons the clone (a session that asked for a very fast shutdown in the instant between the preflight and the stop is caught there). Other SET PERSIST settings are part of the data directory and are inherited by a clone.
  • Profile file. The generated my.cnf (<data dir>/services/mysql-profile-v1.cnf, 0644, no secret in it) is bind-mounted read-only into each container. It needs a Docker daemon that can mount devflow's data directory (Docker on Linux, OrbStack, Docker Desktop and Colima with the home directory shared); a remote daemon cannot. InnoDB only. The profile sets default_storage_engine=InnoDB and disabled_storage_engines (MyISAM, MEMORY, BLACKHOLE, ARCHIVE, CSV, FEDERATED, MERGE): MEMORY tables are not supported, because they lose their rows when the server stops, and a clone stops the source. Before it stops a running source, devflow lists its user tables outside InnoDB (information_schema.tables, base tables outside mysql, sys, information_schema and performance_schema) and refuses, naming them, with the source untouched. A source container started before the profile had these settings is covered by that check only: a MEMORY table created in the instant between the check and the stop loses its rows. A source that was already stopped is not queried.
  • Network. The container is published on 127.0.0.1 only. MySQL generates a self-signed certificate and clients may use TLS (ssl-mode=PREFERRED does); plain connections are accepted too, so the loopback binding and the password are the protection, as for Valkey and Redis. bind-address=0.0.0.0 applies inside the container, which has no other published port (the X protocol is off).
  • Interruption. A clone of a running MySQL source interrupts it for a few seconds: its connections are closed, running statements (even a long ALTER TABLE) are cancelled and rolled back, and clients must reconnect. The downtime is measured, recorded and reported by devflow service status, doctor and the setup output. A stop can outlive its coordinator, and Docker keeps carrying it out after its client has gone. A docker stop is a client of the daemon in a process group of its own, and its request may reach the daemon late, or reach it and lose its client. The request is therefore journaled before it is issued (the container, its StartedAt on the daemon's clock, the time, the timeout and the coordinator's pid) and its outcome after. That no client is visible proves nothing, so whatever restarts a source an operation stopped (a rollback, recovery, a reset's cutover rolled back) first settles an outstanding stop by time: nothing is restarted, and the source is not called healthy, before requested_at + timeout + 30 seconds has passed, when the daemon's stop (SIGTERM, the timeout, SIGKILL) has necessarily finished; a docker stop client still around is waited for and ended only after the deadline the coordinator would have enforced (killing a client that already reached the daemon would turn a graceful stop into a kill). Then docker inspect says whether the container is stopped, started again since (another StartedAt) or still in the run of the request (the stop did not take effect), and a shutdown the server logged as begun is waited for; an answer or a log that cannot be had keeps the recovery pending. Only then it starts the source and checks it, and after a short settle period checks again before the rollback is marked done. The cost is that a recovery of a stop whose return was never seen waits up to the stop timeout (5 minutes) plus 30 seconds. A stop that is known to have returned successfully needs none of this.

Credentials

  • Branch URLs contain passwords. They are written to .devflow/env and to the workspace receipt, both with mode 0600. The URLs of a branch's scratch databases (TEST_DATABASE_URL, …) carry the same password: they are written only to .devflow/env, derived from the receipt's URL (the receipt lists their database names, no password), and masked like DATABASE_URL. So is every [env] value built from a password (DIRECT_URL = "${DATABASE_URL}", a laravel or spring password field, a sqlalchemy URI): such a value is secret, written only to the 0600 file, never shown by devflow, and registered as a known secret so hook output and logs mask it whole. The trust scope and its digest contain templates only, never these values. .devflow/ ignores itself, so it does not appear in git status; never commit it.
  • A managed server publishes one fixed port on 127.0.0.1 (allocated once in 20000–39999 and recorded in admin.json, unless port is set). On OrbStack it is also reachable by name (<service>.<project>-<id8>.devflow.orb.local:5432) from containers and from the Mac; the same credentials are required.
  • A managed server's superuser password is in admin.json and compose.yaml (both mode 0600) under <data dir>/postgres/<project id>/; the data dir is $XDG_DATA_HOME/devflow (macOS: ~/Library/Application Support/devflow) or DEVFLOW_DATA_DIR.
  • An external server's admin URL belongs in the git-ignored devflow.local.toml or in DEVFLOW_PG_ADMIN_URL, never in devflow.toml.
  • Command output and --json documents redact passwords (***) except devflow db url, devflow db branch create, devflow service [NAME] url and devflow env list --show-values, which exist to hand out credentials. Do not log their output. db branch create --instance-id rotates the password of an existing branch, which invalidates URLs handed out earlier.
  • devflow db psql passes the connection (password included) to psql through its environment, never its command line.
  • Literal credentials in [env] recipes. devflow.local.toml is the one place devflow accepts a literal credential in a recipe (devflow env set APP_PASSWORD VALUE --local); it is written as given. devflow env list and the desktop app show a recipe or a resolved value as *** when the variable's name says it holds a credential (a word of the name ends in or contains password, pass, pwd, passphrase, secret, token, key, credential or dsn, in any case or spelling: devflow_core::redact::is_secret_variable) and the recipe has literal text, and by pattern otherwise (a password in a URL, a password= assignment). The decision is taken in core on the key and the value together, before a JSON document, a table or a window renders them: a literal such as APP_PASSWORD = "hunter2" has nothing a text pattern could find, and a serialized {key, template} pair loses the association that masks it by name. A template made only of ${NAME} references is shown as written. An edit command (env set, env unset, env preset) answers with recipe keys only and never repeats a value. devflow env list --show-values is the one way to print the real templates and resolved values; like db url it prints credentials on purpose and its JSON is not redacted, so do not log it. In core the real text is behind RecipeRow::reveal and PreviewRow::reveal; neither is serialized or part of Debug, and neither is FileState::text or Applied::text. The app's edit form opens with the text as written, since it is the editor. devflow trust still lists recipe templates as written, because approving them means reading them.

Redaction contract

Redaction guards against accidental disclosure; it is not a secret scanner.

  • Guaranteed: every credential devflow knows — generated branch and admin passwords, the password of an attached --database-url and every [env] value derived from one — is masked by exact match wherever devflow shows hook output: the terminal, the GUI and the persisted setup logs. devflow's own JSON and GUI fields are redacted by structure. Output is masked a line at a time, so a known credential that contains a line break (a password with an encoded %0A, a recipe built on one) is also masked in each of its lines; a line of fewer than four characters is not masked on its own, since that would mask ordinary text. Errors about configuration, receipts, admin.json and init plans never quote a value, nor any piece of one ([env] recipes and references, [services.*] fields, hook commands, names and timeouts, extra_databases, worktree.copy, admin URLs, TOML and JSON syntax errors): they name the file, the key path (hooks.setup[2].timeout) or the line and column, and the rule that was broken. A deserializer's own message is never shown or searched for a "safe" part; it is classified and rebuilt from the key path and a fixed description (devflow_core::diag). A bare table key is named; any other key is shown as <key not shown>. The commands of a hook that runs are echoed in its output as written, masked like any hook output.
  • Best effort: other credentials in hook output are masked by pattern: URL credentials and secret query parameters (password, %70assword, api_key, …), and KEY=value / KEY: value where the key contains password, passwd, secret, token, api_key or apikey (shell exports, env listings, conninfo strings, YAML, serialized JSON). When unsure where a value ends, more is masked.
  • Not covered: unencoded spaces inside a URL password, .pgpass lines, values that span several lines and are not known credentials, other databases' credential formats (for example SQL Server pwd=), and hooks that deliberately obfuscate what they print. Hooks are trusted code: one that wants to reveal a secret can.

Filesystem

  • worktree.copy paths must be relative and stay inside both the source and the new worktree: .. and symlink escapes are rejected. Entries are staged under a temporary name and renamed into place; existing destination entries are never overwritten.
  • Worktree paths that already exist are refused, never reused.
  • Replacing files you may be editing (devflow init --apply, and the devflow hooks and devflow env edits of devflow.toml and devflow.local.toml, which validate and compute the trust scope between reading and writing). Checking that a file is unedited and then renaming a temporary file over it would overwrite a save that lands in between. devflow stages the new content in a synced sibling file and atomically exchanges it with the file (renamex_np(RENAME_SWAP) on macOS, renameat2(RENAME_EXCHANGE) on Linux), then hashes what was displaced. If it is not what the plan was made from, the files are exchanged back and the apply or edit stops (a ConfigChanged error). If that fails, or the file changed twice, the displaced version is kept next to the file as NAME.devflow-conflict-<timestamp> (its own mode) and the error names both paths: displaced content is never silently lost. A file that did not exist is installed with a hard link, which fails if the name was taken. Where no exchange exists, the file is hard-linked to a backup, checked for a replacement by inode, renamed over and the backup compared; a save by rename in the few instructions between that check and the rename is the one window left, only on such platforms. The permissions of the replaced file carry over.
  • A compose override file (compose.override.yaml, …) counts as present when a directory entry of that name exists, whether or not it can be read: a symlink that leaves the repository or dangles is not followed but makes the volume list incomplete, so init never proposes docker compose down -v while a file it cannot see may rename a volume to the main checkout's.

Network and remote use

  • devflow 1.0 has no TLS support. A managed server is published on 127.0.0.1 by default. Binding to another address, or using an external server across machines, sends database traffic unencrypted. Use a private network such as Tailscale or WireGuard, and do not expose the port to the internet.
  • Access to the Docker engine that runs a managed server is superuser access to its database. Do not give sandboxes a Docker socket, context or SSH key for the data host.
  • Sandboxes should receive only their branch URL. See docs/guide/remote-data-hosts.md.

Repository hygiene

The repository's Git hooks and CI scan every commit, commit message and tag for secrets with kingfisher before they are published; see CONTRIBUTING.md.

Dependencies

Dependabot proposes Cargo and GitHub Actions updates, and CI runs cargo audit on every push. To run it locally:

cargo install cargo-audit
cargo audit

There aren't any published security advisories