Write the published demo password on every migration - #806
Conversation
…ing one The edge01 demo refresh copied `password_hash` straight from the source account, and the README beside it asserted "demo login works". That only held while the source account happened to use the password the project publishes. The source is the operator's own instance, so the moment that password was rotated the demo started rejecting the credentials the README hands to every visitor, and nothing anywhere noticed. Someone eventually filed it as a bug (#805) after being locked out of the shop window. The load now hands the row an explicit password: the same Argon2id literal the seed script writes, applied right after the copy, then read back and compared byte for byte. A mismatch aborts the run rather than waiting for a stranger to discover it at a login screen. The statement goes in on psql's stdin. Interpolating it into the ssh command string would let the remote shell expand the hash's `$argon2id`, `$v`, `$m`, `$t` and `$p` segments to empty strings and store something no password can ever match, which is the same outage wearing a different hat. A guard test pins that too, alongside pinning the literal to the seed script's copy so the two cannot drift apart again.
|
Note on the red The job blocks on one advisory, This branch adds no dependency: the commit is a shell script, its README, and a Tracked separately. Bundling a dependency change into a demo-credentials fix |
The demo refresh copied
password_hashstraight from the source account, andthe README beside it asserted "demo login works". That only held while the
source account happened to use the password this project publishes. The source
is the operator's own instance, so once that password was rotated the demo
began rejecting the credentials the README hands to every visitor, and nothing
noticed until someone was locked out of the shop window and filed #805.
Reproduced before touching anything:
POST /api/auth/loginon the demo answers401 for the published credentials.
What changed
The load now sets the demo password explicitly instead of inheriting one. Right
after the users row lands it is given the same Argon2id literal the seed script
writes, then read back and compared byte for byte; a mismatch aborts the run
rather than waiting for a stranger to find it at a login screen.
The statement travels on psql's stdin. Interpolating it into the ssh command
string would let the remote shell expand the hash's
$argon2id,$v,$m,$tand$psegments to empty strings and store something no password canmatch, which is the same outage wearing a different hat.
scripts/__tests__/demo-published-password-guard.test.tspins three things: theliteral matches the seed script's copy, the overwrite plus its verification are
present, and the hash never appears inside an ssh command string.
Proof
Both mutations were applied, confirmed applied, and confirmed red on the
dedicated test before being restored:
UPDATE→ the overwrite assertion failsFull battery green: typecheck, lint, format:check, build, and 21449 unit tests
across 1886 files. One run tripped a vitest worker teardown race in
stress-score.test.tswith every test passing; a re-run of that file and of thewhole suite came back clean, so it is unrelated to this change.
Still open
This makes the next migration correct. It does not repair the running instance,
which needs the account restored by hand. The demo is also serving 1.37.12 while
the current release is 1.37.24.
Refs #805