Skip to main content
Blue Moose logo Blue Moose Field notes
← All articles
craft cms

Craft 5.12.1: a failed backup leaked the DB login

Server hardware in a data center

The Craft CMS 5.12.1 changelog is long and mostly about the new MCP server, so one line is easy to skim past: the PostgreSQL password could appear in backup or restore error messages. I think it deserves more attention than it gets, because error messages travel further than people expect.

What actually leaked

The trigger is mundane. In issue #20503, the reporter ran Craft 5.12.0.1 in a custom Docker image without pg_dump (no postgresql-client installed). Running Utilities → Database Backup failed, and the exception message contained the whole shell command, including the PGPASSWORD value in plain text, followed by sh: 1: pg_dump: not found.

The reporter also noted the password was sent to their error tracker (GlitchTip). That is the part that matters to me. The same string can land in the control panel, in storage/logs, and in whatever third-party monitoring you wired up.

The fix, and what I can't confirm

The maintainers closed the issue on November 9 with a commit titled “Redact the PostgreSQL password when a database command fails”. It shipped in 5.12.1 on November 10, listed among the access and security fixes. The release notes carry no GHSA advisory for it, so I would not expect a scanner to flag it.

I only read the issue and release notes, not the diff. I can't tell you whether Craft now hides the backup button when pg_dump is missing, which the reporter suggested. Assume the command still fails and only the message is cleaned up.

What I'm doing about it

  • Upgrade to 5.12.1 if you run PostgreSQL. The 5.12.1 release also changes installer behaviour (web installer only in Dev Mode), so skim the notes before you update.
  • Rotate the database password if you ever hit a failed backup or restore on 5.12.0.1 or earlier and your logs went anywhere off-box. Check logs and the error tracker for PGPASSWORD.
  • Install the client tools in custom images. Slim Docker images often skip postgresql-client, and that is exactly how this surfaced.
  • Scrub your error tracker with a server-side rule for strings like PGPASSWORD=, as a second line of defence.

Passing credentials through environment variables on a command line is common, and any wrapper that echoes the failed command will leak it. Redacting at the source is right, but it does not clean up logs that already exist. If your Craft backups ever failed on a minimal image, go look at those logs today.

BM
Blue Moose
The moose behind Blue Moose. Full-stack PHP developer — Drupal by day, Symfony by night, tests always.