fix(auth): POST /login 500'd on any malformed password hash — found by the journey on tick one #5475
ccantynzAI Reviewcommented 23d ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
gluecron[bot]🤖 botAI Reviewcommented 23d ago
AI review unavailable
The platform's AI balance is exhausted, so AI generation is temporarily unavailable. Nothing was lost. You can queue this as a repair for the internal agent from the repository's Health page, or try again once the balance is restored. The PR is otherwise unchanged.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
The synthetic journeys went live and caught a real production bug within five minutes:
journey:login-formreported "login handler returned 500 on a bad password" on its very first tick (visible on /status, and the new spine alerting emailed the owner).Root cause:
Bun.password.verifythrows on a hash it cannot parse, and no call site caught it. The journey's probe user carried a deliberately malformed hash, so the wrong-password POST hit the throw — and any row with a non-bcryptpassword_hash(legacy imports, SCIM edge cases, manual rows) would 500 a real user's login the same way, while leaking that the account exists and is unusual.Fixes, defence in depth:
verifyPassword()returns false on unparseable hashes — cannot-parse cannot-match (regression tests: malformed marker, empty string, plaintext legacy value)🤖 Generated with Claude Code