Workday's DR Test Wrote to Production. A Standby That Can Reach the Primary Needs a Fence.
Replication gives the standby site a route to the primary. Isolation cannot close it, so the database has to refuse the connection itself.
A disaster recovery test is supposed to be the safe kind of risk. On Friday 13 November, Workday took its production tenants offline at about 4:15 pm US Central time. The cause, according to the customer notice that universities quoted on their status pages, was that tenanted services in its disaster recovery site had "unexpectedly connected to Production databases" while Workday was validating a DR maintenance window. Data was left in an inconsistent state across two data centres. Service was restored by 11 am Eastern on Saturday, roughly 18 hours later, according to the statement Workday gave to US broadcasters (UC Today has a timeline). Workday said it was not a cybersecurity incident.
People could not clock in, check pay or request leave. Workday has not published a root cause, and this article does not guess at one. The useful question for everyone else is narrower: in your own setup, what stops a disaster recovery test from writing to production? For most teams running database replication, the honest answer is a configuration file and some hope.
The path from DR to production exists by design
The common mental model of a DR site is a sealed copy: data flows in from production, nothing flows out. Streaming replication does not work that way. In Postgres physical replication, the standby opens the connection. Its primary_conninfo setting names the primary's host and port, and the standby dials out to it to pull WAL. MySQL replicas behave the same way: the replica connects to the source. So the DR site does not merely receive traffic from production. It needs a working TCP route to the production database port, all the time.
That route is the one an application in the DR site would use to write to production. A network rule cannot tell the two apart. Both are connections from a DR address to port 5432 on the primary. If your DR isolation is "only the database port is open", it is open for everything that speaks the database protocol.
This is why a DR environment that is idle is safe and one that is being tested is not. While nothing runs in DR except the standby, the open route carries only replication. A drill starts application services in DR: API servers, job workers, integration runners. Each reads its configuration, finds a database host, and connects. If any of those hosts resolves to the production primary, through a shared config bundle, a global DNS name, a missing per-site override, or a secret copied from production, the drill is now a second writer.
What "inconsistent" costs: reconciliation, not restart
An ordinary outage is one system down. Recovery is a restart, a failover, or a rollback, and it takes minutes to a few hours. Two writers is a different class of failure. For some window, two sets of services believed they owned the same rows. Jobs may have run twice. A sequence may have advanced from both sides. A transaction one service wrote may be missing from the state another service holds in cache or in a search index.
You cannot roll back to a snapshot without losing legitimate production writes made in the same window. You have to work out, per tenant, which writes came from where, keep the right ones, and rebuild everything derived from them. Workday's customer notice described tenants returning in stages after their data was reindexed, which is what per-tenant reconciliation looks like from outside. That is where 18 hours goes.
“A database that is down costs you availability. A database with two writers costs you the truth, and the truth takes longer to restore.”
Fence 1: the primary refuses DR sessions itself
Since the network route has to exist, the refusal has to come from the one component that knows what kind of connection it is receiving: the primary database. Postgres decides this in pg_hba.conf, which is evaluated top to bottom, and the first line that matches the connection type, database, user and source address wins. Replication connections match the special database name "replication". That gives you a precise rule: the standby host may connect for replication as the replication role, and every other connection from the DR address range is rejected before authentication is even attempted.
# pg_hba.conf on the PRODUCTION primary. First matching line wins.
# TYPE DATABASE USER ADDRESS METHOD
# 1. The DR standby may stream WAL, as the replication role, from its own host.
hostssl replication replicator 10.20.4.11/32 scram-sha-256
# 2. Everything else from the DR range is refused, whatever the credentials.
host all all 10.20.0.0/16 reject
# 3. Production application subnets, production roles only.
hostssl app_db app_rw 10.10.8.0/22 scram-sha-256Two details matter. The reject lines must come after the replication line and before any broad allow rule, because order is the whole mechanism. And the reject rule keys on source address, not on credentials, so it holds even if someone copied the production application password into the DR secret store. On managed databases where you cannot edit pg_hba.conf directly, the equivalent is usually a combination of security-group rules scoped to the standby's address and database roles that carry a REPLICATION attribute but no table privileges. Check what your provider exposes before you assume it is covered.
When you fail over for real, this file is part of the runbook: the new primary in the DR site needs its own pg_hba.conf that accepts the DR application subnet, and the old primary needs to reject it. Keep both versions in version control and apply them as one step of promotion, not as a separate change someone remembers later.
Fence 2: DR has its own identity, and production does not know it
Address-based rules break when networks change, so add a second layer that does not depend on them. Give the DR site its own database roles, its own service-account credentials, and its own secrets store, populated independently rather than copied. The production primary should have no role that DR services hold credentials for, apart from the replication role. If a DR API server somehow reaches the primary on an address you did not anticipate, it presents a username that does not exist there and fails at authentication.
The same principle applies above the database. Message brokers, object storage buckets, payment gateways and outbound email accounts are all things a DR application service may write to. A second writer against a production queue or an external API is the same failure, harder to undo, because you cannot reconcile an email that has already been sent.
Fence 3: writes carry the writer's epoch
The first two fences stop a DR service from opening a session. They do not help if the DR site is promoted while the old primary is still alive, which is the classic split-brain. For that, distributed-systems practice uses fencing tokens, described clearly in Martin Kleppmann's essay on distributed locking: a number that increases each time leadership changes, attached to every write, so that storage can reject a write carrying a stale number.
In a database-backed application, the practical version is a site epoch. A single-row table holds the current epoch and the site that owns it. Promotion increments it. Every service reads its own site's epoch at startup and includes it in a guard on writes, for example through a check in the transaction or a trigger that compares the session's declared epoch with the stored one. A service from the losing side then fails loudly instead of writing quietly. It costs a little latency and some discipline, and it is the only one of the three fences that works when both sites are, legitimately, configured as primary.
| Fence | What it stops | What it misses |
|---|---|---|
| Primary rejects non-replication sessions from the DR range | DR application services connecting by any credential from known DR addresses | Connections from addresses you did not list, such as NAT or a new subnet |
| Separate DR roles and secrets | DR services authenticating to production even from unexpected addresses | Shared secrets copied by hand, and external systems with one shared API key |
| Site epoch on every write | A demoted or stale site writing after promotion | Nothing at session level; it assumes services honour the guard |
Make every disaster recovery test prove the fence first
Every DR drill tests that the standby can take over. Very few test the opposite: that, before takeover, DR cannot touch production. Write that as a preflight that runs inside the DR site, using the DR site's real configuration, before any application service is started. It should try to open an ordinary application session against each production database host, and fail the drill if any attempt succeeds.
#!/usr/bin/env bash
# dr-preflight.sh: run inside the DR site BEFORE any application service starts.
# The drill fails if the DR site can open an ordinary session on production.
set -u
PROD_HOSTS="db-primary.prod.internal:5432 db-replica-1.prod.internal:5432"
for target in $PROD_HOSTS; do
host=${target%%:*}; port=${target##*:}
if psql "host=$host port=$port dbname=app_db user=app_rw connect_timeout=3" \
-Atc 'select 1' >/dev/null 2>&1; then
echo "FAIL: DR site opened an app session on $host. Abort the drill."
exit 1
fi
done
echo "OK: no production app session reachable from DR."Add the same check for whichever other production endpoints your services write to. Then add one more step that people skip: start a single application instance in DR, have it log the resolved address of every downstream dependency, and diff that list against the production address ranges. A missing per-site override is invisible in a config file and obvious in a resolved-address log.
A short checklist for the next drill
- Confirm the production primary's auth rules accept only the replication role from the standby host, and reject everything else from the DR range.
- Confirm no DR secret matches a production secret, for databases, brokers, storage and third-party APIs.
- Run the preflight from the DR application subnet. A failure aborts the drill.
- Start one service instance, log every resolved dependency address, and diff it against production ranges.
- Write down how promotion changes the auth rules and the site epoch, and rehearse that step, not just the database switchover.
None of this guarantees that a DR environment cannot misbehave. It changes the default. Today, in most setups, a DR service with the wrong hostname writes to production and nobody finds out until the data disagrees. With fences in place, the same mistake produces a connection error in a drill log on a Tuesday afternoon, and DR testing goes back to being the boring exercise it was meant to be.
Frequently asked questions
Related reading
Postgres Shipped 52 Security Fixes on 12 November. Revoking the TEMPORARY Privilege Covers Only Some.
A public proof of concept turned a fresh Postgres login role into a shell. The suggested fix, revoking TEMPORARY from PUBLIC, helps. It does not cover most of the 12 November release.
GitHub Blocks pull_request_target in Public Repos on 2 December. Four Routes to the Same Attack Stay Open.
GitHub enforces a default block on pull_request_target in public repositories on 2 December 2026. It leaves private repos, issue_comment bots, pre-July checkout pins and existing event policies untouched.
RBI Cyber Resilience Directions Bind Payment Operators. Six Clauses Land on Their Vendors.
RBI's consolidated directions for non-bank payment operators took effect on 5 November. If you sell software to a payment aggregator or wallet issuer, six of its clauses will arrive in your next contract.