Aller au contenu principal

Refusing to Wipe Yourself: RESP Safety When No Password Is Set

· 10 minutes de lecture
Clustron Team
Ingénierie des systèmes distribués

There is a well-worn genre of outage story that always opens the same way: a cache was stood up for a quick test, the Redis-protocol port was left on the default bind, no password was set because it was "just a test," and somewhere between a few minutes and a few days later every key was gone. Sometimes it is a misconfigured service discovery pointing production traffic at the test box. More often it is a background scanner on the public internet that found an open port, spoke the protocol, and sent FLUSHALL because that is exactly what the scanners are written to do. The store did what it was told. It had no reason not to — nobody had told it to be careful.

That failure is not really a Redis bug; it is a default. A data store that speaks an unauthenticated protocol and binds to every interface the moment it starts has made a choice on your behalf, and the choice is "trust whoever can reach the socket." For a local development convenience that is fine. For anything with a routable address it is a standing liability, and the liability is worst in the exact window where it is least watched: the first few minutes of a new deployment, before auth is wired up, when the store is already listening and already destroyable.

Zaris inverts that default. When the RESP (Redis-protocol) endpoint is enabled but no password is configured, the store does two things without being asked: it binds the listener to loopback only, and it refuses the commands that can irreversibly destroy data. You have to opt out of that safety to get the wide-open behaviour, and opting out is explicit and auditable. This post is about what that hardening is, where it lives, and how to lift it on purpose.

Two different dangers, two different guards​

"No password" creates two separate exposures, and they need two separate answers.

The first is reachability: who can even open a connection. A listener bound to 0.0.0.0 on a host with a public or VPC-wide address is reachable by anything that can route to it, password or not. The second is authority: what an unauthenticated connection is allowed to do once it is open. These are independent — a connection can be local-but-unauthenticated, or remote-but-authenticated — so a single switch cannot cover both. Zaris guards each one.

For reachability, the rule is: no password means loopback-only. If you enable the RESP endpoint without configuring a password, the listener binds to 127.0.0.1, and nothing off the box can reach it. A test store on a cloud instance is not silently exposed to the instance's network the way it would be with a default-all-interfaces bind. You can reach it from the machine itself — which is the whole point of a local test — and from nowhere else.

For authority, the rule is: no password means the destructive commands are refused. Even over that loopback connection, an unauthenticated session cannot issue the commands that wipe data wholesale — FLUSHALL, FLUSHDB — and instead gets a clear protocol error. Ordinary reads and writes to individual keys work, so the store is usable for its purpose; the blast-radius commands are the ones held back.

What the refusal actually looks like​

The behaviour is deliberately boring, which is what you want from a safety interlock. An unauthenticated client that reaches a no-password store and tries to flush it gets an error reply, not a quiet success:

$ redis-cli -p 6379
127.0.0.1:6379> SET greeting hello
OK
127.0.0.1:6379> GET greeting
"hello"
127.0.0.1:6379> FLUSHALL
(error) ERR this command requires authentication when no password is configured
127.0.0.1:6379> GET greeting
"hello"

The individual SET and GET succeed; the FLUSHALL is refused with an explicit -ERR that names the reason; and — the part that matters — the key that existed before the refused flush still exists after it. The command did not half-run. It did not clear some keys and error on others. It was rejected whole, before it touched anything, and the store is in exactly the state it was in before the attempt.

That "the data survives the refusal" property is the one worth testing, because it is the difference between a warning and a guard. A message that says "you probably shouldn't" while still deleting everything is not a safety feature. The refusal is enforced at the command dispatch point, so a destructive command from an unauthenticated session never reaches the code that would carry it out.

Why the guard lives on the server​

The obvious objection is "that is what a firewall is for." And a firewall is for that — it is a fine second layer. But a firewall is a different system, owned by a different team, configured in a different place, and it is not present in the window that matters most: the minutes between the store starting and the network policy being applied. The store is listening before the firewall rule lands. A security property that depends on another component being correctly configured first is a property you do not actually have yet.

Putting the guard in the store closes that window, because the store cannot start in an unsafe posture and then be fixed — it starts safe. It also makes the safety travel with the data, not with the deployment. Move the store to a new environment, run it in a container someone else wired up, hand it to a colleague who skipped the networking section of the docs: the loopback bind and the destructive-command refusal come along, because they are a property of the store's own configuration, not of the box it happens to be on. Defence in depth means each layer holds on its own; the firewall and the server guard are not redundant, they cover different failure modes — the firewall that was never applied, and the store that was pointed at the wrong network.

Remote clientoff-box addressblocked: loopback-only bindLocal client127.0.0.1SET / GET okZaris RESPno password setbind: loopback onlydispatch guard: onFLUSHALL→ -ERR requires authkeys surviverefused whole

Opening it up, on purpose​

Safe-by-default is only useful if the deliberate path is easy, or people route around it. Two configuration flags take you from the locked-down posture to a production one, and the names say what they do.

Set a password and both guards relax in the way you would expect: authenticated sessions can issue the destructive commands, and the listener is allowed to bind beyond loopback because connections now have to prove themselves. This is the normal production shape — a credentialed RESP endpoint reachable from your application tier.

If you genuinely want an unauthenticated endpoint reachable off-box — a throwaway cluster on a trusted, isolated network, say — you have to say so explicitly with ZARIS_RESP_ALLOW_INSECURE_BIND. The name is doing deliberate work: there is no way to end up bound to a public interface without a password by accident, because the only path there is a flag with the word "insecure" in it that you had to set yourself. The destructive-command refusal is tied to the same "no password" condition, so configuring a password is what lifts it; the insecure-bind flag changes reachability, not authority.

The ordering of these is the whole ergonomics of the feature. The safe state is free and automatic. The production state (set a password) is one deliberate step and relaxes the guards in a principled way. The unsafe state (no password, public bind) is reachable only by explicitly naming it. You can get to any posture you need; you just cannot fall into the dangerous one.

Wrap-up​

An unauthenticated key-value endpoint that boots wide-open and honours FLUSHALL from anyone who can reach the port is a convenience that doubles as a loaded gun, and the first few minutes of a deployment — listening, unauthenticated, not yet firewalled — are when it is most likely to go off. Zaris refuses to ship that default. With no password set, it binds to loopback so nothing off the box can reach it, and it refuses the data-destroying commands at dispatch so that even a local unauthenticated session cannot wipe the store, with existing keys provably surviving the attempt. Both guards live in the server, so they hold before any firewall rule lands and travel with the store wherever it runs. Set a password to move to a credentialed production endpoint; name the insecure-bind flag explicitly if you ever truly want an open one. The dangerous posture is still available — it is just the one state you have to ask for by name, instead of the one you get for free.