Run it
Security
Who can connect, what clients may change, how data travels, where copies live, and what the bench token and the dashboard allow.
Authentication
- A shared password.
VALKEY_PASSWORDmakes AUTH mandatory, and the AUTH username names the database. There are no users or ACLs within a database. - Optional per-database passwords. A database created with
password=newtakes only its own password over TCP or the WebSocket. The catalog keeps a salted SHA-256 of it. Any other database takes the shared password, and a service binding's shared password opens every database. - A wrong password creates nothing. AUTH checks the shared password before it looks up or creates a database. Passwords are compared in constant time.
- Failed AUTHs are rate limited to 30 a minute per client address, then refused for a minute. Service bindings aren't limited.
- Before AUTH, only AUTH, HELLO and QUIT run, and requests are capped at 64 KB.
Without a password
Anything that reaches connect() is in. That is fine behind a service binding, which only your own Workers can call. Set the password before putting Spectrum in front; /ws refuses to serve without one.
What clients can change
Persistence, memory, networking and auth belong to the service. CONFIG SET takes only settings that change how data behaves: maxmemory-policy, maxmemory-samples, notify-keyspace-events, the listpack, ziplist, intset, HyperLogLog and stream encoding thresholds, lfu-log-factor, lfu-decay-time, the slowlog and latency monitor settings, busy-reply-threshold, lua-time-limit and activerehashing.
An allowed setting goes to every primary and lasts until that shard restarts. Anything else gets an error. CONFIG inside MULTI, SAVE, BGREWRITEAOF and ACL are refused.
Transport
- Spectrum: turn on TLS. Without it the password and all data cross the internet in plain text.
- WebSocket: use
wss://. The shim's local port is plain text on 127.0.0.1. - Service binding: stays inside Cloudflare.
- Between objects: only code in this Worker holds the bindings that reach shards, replicas and rewriters. Clients reach only the router.
Replicas and data location
A replica is a full copy of its shard, in memory, in its region. Data that must stay in one region doesn't belong in a database with shards or replicas elsewhere. Replica names can't be claimed by a client: database names can't contain dots, so no database maps onto <shard>.r.<region>. Object names carry database names, so anyone who can read the Worker's logs can see which databases exist.
The bench token and the dashboard
The bench API is off unless BENCH_TOKEN is set, and with the token anyone can do anything to any database. The dashboard lists every database's name and anyone can watch one; watching reads one key a second for response times, and writes it only while someone signed in watches. Changes check the Access token on every call, and the router's own checks still apply to commands run from the dashboard.