Security
ddev-sync reads production credentials, dumps a production database over SSH and writes it onto your machine. A mistake here leaves real customer data somewhere it should not be. This page lists what the tool does and the exposures that are accepted on purpose, so you can judge whether they matter in your environment.
Reporting a vulnerability
Section titled “Reporting a vulnerability”Report security issues privately to security@noix.dev, or through a private security advisory on GitHub. Please do not open a public issue. Include a description, steps to reproduce and the affected version, and redact production hostnames, usernames, passwords and anything out of a dump. A first answer typically comes within 3 business days. Security updates are provided for the main branch.
What it reads and writes
Section titled “What it reads and writes”- On the remote: it runs
mysqldumpand a few read-only probes over SSH, reads the environment file that holds the database credentials (and the valuesenv.pullnames, from the same file), and reads the files you list infiles.pathswith rsync. It writes nothing there. - On your machine: it drops and recreates the local database, writes the dump to
.ddev/.downloads/, rewrites the local environment file (after showing a diff), writes rsync’d files into the project and runs your setup commands. Secrets it prints are masked. - Configuration:
ddev sync initwrites.ddev/ddev-sync.yamland, for credentials you enter,.ddev/ddev-sync/local.yaml. It never writes your global file. S3 keys in the committed project file are refused.
Accepted exposures
Section titled “Accepted exposures”The dump password is visible on the remote
Section titled “The dump password is visible on the remote”mysqldump is started with --password= over SSH, so anyone who can read the process list on the production host while the dump runs can see it. Avoiding that needs a temporary options file on the remote, which this tool deliberately does not write. If process-list exposure is unacceptable for a host, do not sync from it with this tool.
The sync container mounts the Docker socket
Section titled “The sync container mounts the Docker socket”Framework commands run in your project’s own web container through docker exec, which needs /var/run/docker.sock inside the sync container. Anything that can talk to that socket can start a privileged container on the host. The container’s group is discovered at every project start, rather than assumed: it joins whichever group owns the socket. On Docker Desktop for Mac, the only setup exercised, that group is root inside the VM, so the container gets root-group access to the Docker daemon there.
A Docker endpoint gives a shell beside production
Section titled “A Docker endpoint gives a shell beside production”With provider: docker, the stack you deploy publishes an endpoint, and whoever holds a key in its authorized keys gets a shell in it. That shell sits on the production stack’s network, reads production’s own environment file and has a MariaDB client, so “may sync” means “may change the production database”, not only “may read it”. Read-only mounts protect the files and nothing more. The limit is the key list.
What the design removes is the privilege otherwise needed to sync from a Docker host: no Docker socket, no docker group, no root on the host. Also know that:
- The endpoint runs as root inside itself, because an SSH server can only serve a user that has a passwd entry. The session runs as the uid you configure. The container has no Docker socket, no added capabilities, read-only payload mounts and a port published on the host’s loopback address only. Drop capabilities in your own compose file if your environment expects it.
- There is one account for every developer. The only attribution of a sync is the key fingerprint in the endpoint’s SSH log. Revocation is per key.
- Rate limiting is off on purpose, because every developer reaches the endpoint through the same Docker host and per-source penalties would let one stale key lock out the team. Keys and the loopback-only port are what protect it.
all hands the session the whole environment
Section titled “all hands the session the whole environment”DDEV_SYNC_EXPORT_ENV normally lists the variables an endpoint passes to the sync. Set to the single word all, it passes every variable given to the endpoint container, except the endpoint’s own DDEV_SYNC_ settings. Whoever holds a key can then read all of them in the session, for instance S3 keys, payment keys or a Redis password, not only the database credentials. They could already change the production database, so this adds reach to the other secrets in that container.
The deployer chooses it, in the stack, with one visible word, and a list keeps the old behaviour. What reaches a developer’s laptop is what the project names in env.pull and its profile’s defaults, unless the project also sets env.pull_all, which copies all of it. Give the endpoint container only the variables you accept this for, see Handing over everything with all.
Pulled values land in a local file
Section titled “Pulled values land in a local file”With env.pull, production values such as an application key are written into the developer’s local environment file. A file ddev-sync creates is readable by its owner only, and an existing file keeps its mode. It masks the values in everything it prints, and does not check that the file is ignored by git, since the sidecar may have no git. Keep it out of version control. See Pulling values from the remote.
A host is trusted the first time it is seen
Section titled “A host is trusted the first time it is seen”Every ssh, scp and rsync runs with StrictHostKeyChecking=accept-new. A host that is not in known_hosts yet is accepted without asking, and whoever answers the very first connection is trusted from then on. This was chosen because the sync container has no terminal to ask in. A host whose key changes is still refused, and doctor reports it as Host key changed. Under the add-on, known_hosts persists, so the exposure is one silent acceptance per host.
There is no setting to make this stricter or to turn it off. To have the first connection verified, add the host’s key to .ddev/ddev-sync/home/.ssh/known_hosts yourself before the first sync.
A jump host is treated the same way: its key is trusted on first use and refused when it changes.
Nothing is ever asked. Every connection runs with BatchMode=yes, so a password, a key passphrase or a second factor is a refusal that doctor reports. Keys come from DDEV’s SSH agent; add a key that has a passphrase with ddev auth ssh first.
The shared connection socket
Section titled “The shared connection socket”A run opens one connection per target and shares it with every later ssh, scp and rsync, which keeps a rate-limiting server from cutting the sync off. The connection stays open for 60 seconds after its last use. Its socket is a way into the remote shell for anyone who can open it, so it lives in /tmp/ddev-sync-<uid>/, which ddev-sync creates readable only by you and refuses to use when it is anything else. See Shared connection directory.
What sanitize does and does not guarantee
Section titled “What sanitize does and does not guarantee”Sanitize rules keep production data from living on a laptop: they empty sessions and queues, anonymise user tables and reset passwords after the import. They are declared per project type, and a rule that was never run against a real installation can silently do nothing, for example a requires_table naming a table that does not exist.
- Rules run only if the
sanitizestep is part of the run. Without it, the run warns that the data was not sanitized. sanitize.disable_sanitizeandsanitize.disable_sanitize_allswitch rules off, and every run with one set names the switch and the file.- Verified rules records, per profile variant and per rule, what has been exercised against a real installation. Read it before you trust a profile with a production database. A profile whose rules are listed as unverified is not a security guarantee. Frameworks summarises it.
- Sanitize works on the local database. With
defaults.keep_dumpon, the dump file stays in.ddev/.downloads/exactly as it came from production, unsanitized.
See Sanitizing for the rules themselves.