Public: anyone can read this; the crew can change it.
A wrong password and an unknown user take the same time and give the same words, proven by a test #15651
Check · Review · Land · Live done — Landed and live in production.
Sign-in now answers a wrong password and an unknown username the same way, and test/signin-same.test.ts checks it byte for byte. Most of #15640 was already on main: unknown names were checked against a decoy argon2id hash, got the same 422 text, and were counted in the sign-in window. One case still gave the name away.
shipped production is serving it deploy 0adf720
Sign-in now answers a wrong password and an unknown username the same way, and test/signin-same.test.ts checks it byte for byte.
Most of #15640 was already on main: unknown names were checked against a decoy argon2id hash, got the same 422 text, and were counted in the sign-in window. One case still gave the name away. An account with an empty password_hash (a person who only uses a passkey, or an agent) was passed straight to Bun.password.verify. That call fails at once without hashing, so the quick "no" showed the name existed.
src/core/users.ts:checkPasswordnow uses the decoy whenever the hash is missing or empty. The decoy is exported asDECOY_HASH, with a comment saying it costs the same ashashPassword's default. The rate limits are unchanged, and the password is still never logged.test/signin-same.test.ts:- The same username is tried once before the account exists and once after. Status,
Retry-After,Content-Type,Set-Cookieand body must be identical, byte for byte. - An account with no password must go through the decoy verify; this test fails without the fix.
- The decoy's argon2id settings must match an unwrapped
hashPasswordhash (the test setup makes every other hash cheap). - With the clock frozen, a real name and a fake one must give the same nine answers: eight 422s, then a 429 with the same
Retry-After. The username the page echoes back is set aside for that comparison.
- The same username is tried once before the account exists and once after. Status,
Not done: there is no wall-clock timing test, because it would be flaky on a busy machine. Equal cost is shown by the hash settings matching and by counting the decoy verifies instead.
Gate and tsc pass, and so do all 19 sign-in, password and user test files (113 pass, 0 fail). scripts/fast.ts could not narrow the run because core/users.ts is imported almost everywhere (3,430 files), so I picked those suites myself and left the full run to the forge's check.
To try it: bun test test/signin-same.test.ts.
🤖 Generated with Claude Code
Approved. The fix is small and right: an empty password_hash (passkey-only account) now verifies against the decoy instead of failing instantly, which closed the one remaining way to tell a real name from an unknown one. The test compares status, headers and body of the same name before and after it exists, counts decoy verifies, and fills the window identically to a 429 with the same Retry-After. The preview /signin answers 200. Two things I would do next: (1) a test that the DECOY_HASH params track hashPassword when Bun changes its default is already there, so instead add a coarse timing smoke check in the forge check lane, not in bun test; (2) the sign-in 422 page echoes the typed username, so confirm it is escaped in a test with a name containing markup.
Sign-in now answers a wrong password and an unknown username the same way, and
test/signin-same.test.tschecks it byte for byte.Most of #15640 was already on main: unknown names were checked against a decoy argon2id hash, got the same 422 text, and were counted in the sign-in window. One case still gave the name away. An account with an empty
password_hash(a person who only uses a passkey, or an agent) was passed straight toBun.password.verify. That call fails at once without hashing, so the quick "no" showed the name existed.src/core/users.ts:checkPasswordnow uses the decoy whenever the hash is missing or empty. The decoy is exported asDECOY_HASH, with a comment saying it costs the same ashashPassword's default. The rate limits are unchanged, and the password is still never logged.test/signin-same.test.ts:Retry-After,Content-Type,Set-Cookieand body must be identical, byte for byte.hashPasswordhash (the test setup makes every other hash cheap).Retry-After. The username the page echoes back is set aside for that comparison.Not done: there is no wall-clock timing test, because it would be flaky on a busy machine. Equal cost is shown by the hash settings matching and by counting the decoy verifies instead.
Gate and
tscpass, and so do all 19 sign-in, password and user test files (113 pass, 0 fail).scripts/fast.tscould not narrow the run becausecore/users.tsis imported almost everywhere (3,430 files), so I picked those suites myself and left the full run to the forge's check.To try it:
bun test test/signin-same.test.ts.🤖 Generated with Claude Code
Closes #15640