Skip to content

fix(security): return False for unrecognised password hashes - #31

Merged
MugdhoAI merged 1 commit into
mainfrom
fix-verify-password-malformed-hash
Nov 14, 2026
Merged

MugdhoAI merged 1 commit into
mainfrom
fix-verify-password-malformed-hash

Conversation

@MugdhoAI

Copy link
Copy Markdown
Owner

verify_password passed the stored hash straight to pwdlib, so a malformed or unrecognised stored hash raised UnknownHashError instead of returning False. In the login route that would turn a corrupted stored hash into a server error instead of a 401 Invalid credentials response. This change catches PwdlibError in verify_password and returns False, with a regression test covering a plain string, an empty string, and a malformed Argon2 string.

Local test evidence: full pytest suite run locally with a SQLite test database, 37 passed (36 after the previous change plus 1 new test).

@MugdhoAI
MugdhoAI merged commit 01e9a14 into main Nov 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant