Repository navigation
fix(users): reject imported Argon2 hashes that can never verify - #14924
Conversation
Argon2 needs a salt of at least 8 bytes, a tag of at least 4 bytes and at least 8 KiB of memory per lane. Imports below those bounds were stored, then failed every sign-in.
|
Review complete. No issues found — approved ✅. This PR hardens Argon2 hash validation by enforcing the Argon2 reference minimums: an 8-byte salt, a 4-byte hash tag, and a memory cost of at least 8 KiB per lane (m >= 8*p), on top of the existing maxima. The validation math was verified correct against RFC 9106 and the Argon2 reference implementation.
Reviewed commit: 973f2d0 |
🟢 Tier S · Ready to merge
The Argon2 hash validator now rejects imported hashes whose decoded salt or tag is below Argon2's minimum lengths, as well as hashes whose memory cost is too small for their parallelism. The Users E2E hash-limit test adds examples for these rejected inputs.
📂 Walkthrough · 2
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
POST /v1/users/argon2accepted Argon2 hashes that can never be verified, so the import succeeded and every sign-in for that user then failed.Hash\Argon2now also requires:Found while backporting #14825 to 1.9.x (#14910, which ships the same check).
Test
UsersBase::testCreateUserHashLimitsgets four new refused hashes. Against the current validator all four are accepted, so the test fails without this fix.