Repository navigation
fix(auth): use configured Argon2 params on signup and user create - #14101
Conversation
Sign-up, Users API create/update password, and login rehash were instantiating a fresh ProofsPassword()/Argon2 with library defaults (64 MiB/4/3) instead of the injected proofForPassword (7 MiB/5/1). Wire those paths through the shared resource so all hashes match the configured parameters. Fixes #14099 Co-authored-by: chiragaggarwal5k <[email protected]>
🟢 Tier S · Ready to merge
Uses the configured password-proof resource for account signup, Users API creation and password updates, and login rehashing. Login also refreshes Argon2 hashes with outdated variants or costs. E2E coverage checks persisted settings and successful login after rehashing, now including an Argon2id fixture with the previous signup costs. Latest changes: Adds an old-cost Argon2id fixture to the login rehash regression test and updates the expected user count.
Note @cursor[bot] does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve. 📂 Walkthrough · 6
✅ Fixed since the last review · 1
Reviewed the commits since |
…hash Adds E2E coverage so plaintext user create, password update, and login algo-rehash persist memory 7168 / time 5 / threads 1 from proofForPassword instead of the Argon2 library defaults. Co-authored-by: chiragaggarwal5k <[email protected]>
Co-authored-by: chiragaggarwal5k <[email protected]>
Login only rehashes when the stored algorithm name differs from argon2, so the imported argon2i fixture keeps m=20,t=3,p=2. Assert preservation there and configured costs only for algorithms that were actually upgraded. Co-authored-by: chiragaggarwal5k <[email protected]>
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Login only rehashed when the algorithm differed, so users hashed with the library default (64 MiB, 4 passes, 3 threads) kept that cost until they changed their password. Compare the stored hash against the configured costs with password_needs_rehash(), which reads them from the hash itself rather than from hashOptions.
|
@hansi-codes re-review and give tick if all good |
|
✅ Re-reviewed; no new blocking issues found.
This is a code-review tick, not confirmation of passing checks: I haven’t run the tests, and the benchmark report is inconclusive. |
@hansi-codes give a tick |
|
✅ No blocking issues found in the code review. Tests remain unverified. |
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114, #14101, #14125, #14129, #14127) so cloud#5410 can require a train head that contains main at or after 0ed7232. Conflicts: none. Database 8.0 port: none needed. Main's new code only uses Document getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit (Tasks/Interval.php), all unchanged in database 8.0; no removed Database::* constants, config collections, or model magic reads. composer.json and composer.lock are untouched by main, so the train's database and migration pins stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Account signup, Users API create/update password, and login algo-rehash were constructing a fresh
ProofsPassword()/Argon2with library defaults (64 MiB / time 4 / threads 3) instead of using the injectedproofForPasswordresource (7 MiB / time 5 / threads 1 fromapp/init/resources/request.php).This wires those paths through the shared resource so newly created and rehashed passwords use the configured Argon2 parameters consistently with recovery / password-update flows that already did.
Login now also rehashes Argon2 passwords whose costs differ from the configured ones (
password_needs_rehash()on the stored hash, nothashOptions), so users already hashed at 64 MiB / 4 / 3 converge on their next login instead of keeping the expensive hash until they change their password.Test Plan
POST /v1/accountand confirm storedhashOptionsmatchmemoryCost=7168,timeCost=5,threads=1(or the PHC stringm=7168,t=5,p=1).POST /v1/userswith a plaintext password and confirm the same options.PATCH /v1/users/{id}/passwordand confirm the same options.$argon2i$v=19$m=20,t=3,p=2$…) and confirm the hash is rewritten tom=7168,t=5,p=1.Related PRs and Issues
Checklist