Skip to content

πŸ› Bug Report: Sign-up ignores the configured Argon2 parametersΒ #14099

Closed

Description

@JoshiJoshiJoshi

πŸ‘Ÿ Reproduction steps

  1. Create a user with POST /v1/account (or POST /v1/users) and look at the stored hash/hashOptions or the PHC string: $argon2id$v=19$m=65536,t=4,p=3$….
  2. Change the password of a user with PATCH /v1/account/password (or go through recovery): $argon2id$v=19$m=7168,t=5,p=1$….

πŸ‘ Expected behavior

All password hashes use the parameters of the proofForPassword resource (app/init/resources/request.php L90–L101: memory 7168 KiB, time 5, threads 1).

πŸ‘Ž Actual Behavior

Some paths use the injected proofForPassword, others create a fresh new ProofsPassword() / new Argon2() and get the class defaults of Utopia\Auth\Hashes\Argon2 (memory 65536 KiB, time 4, threads 3; on main in packages/auth/src/Hashes/Argon2.php L17–L19):

Path Parameters
POST /v1/account (account.php L376) 64 MiB / 4 / 3
POST /v1/users (Users/Base.php L102) 64 MiB / 4 / 3
PATCH /v1/users/{userId}/password (Users/Password/Update.php L114) 64 MiB / 4 / 3
rehash on login when the algorithm differs (account.php L1087) 64 MiB / 4 / 3
PATCH /v1/account/password, recovery, users created via anonymous/magic URL/email token/OAuth/team invite 7 MiB / 5 / 1

Login verifies with the parameters stored in the hash and only rehashes when the algorithm differs, so users who signed up keep the expensive hash until they change their password themselves. main has the same code.

Cost of one password_verify() inside the 2.3.0 API container (4 vCPU): 64 MiB/4/3 58 ms wall, β‰ˆ 150 ms CPU (three threads); 7 MiB/5/1 12 ms. The Swoole worker is blocked for the whole time.

Load test through the API (two API nodes with 4 vCPU each, Postgres on a third node, 1,500 imported users per group via POST /v1/users/argon2 with a pre-computed hash of the same password, logins round-robin, 20 s per step, two runs):

Hash of the users 16 connections 64 connections p50 (16) CPU API nodes
64 MiB / 4 / 3 (sign-up, Users API) 49 / 51 logins/s 51 / 51 logins/s 314–322 ms 100 %
7 MiB / 5 / 1 (proofForPassword) 200 / 220 logins/s 266 / 212 logins/s 68–77 ms 82–98 %

Sign-up itself is capped the same way: 46–49 POST /v1/account per second for both nodes together, independent of concurrency (8–64), API CPU 96–100 %.

🎲 Appwrite version

2.3.0 (main unchanged)

πŸ’» Operating system

Linux (Debian 12), Docker

🧱 Your Environment

Self-hosted, two API nodes (4 vCPU each), Postgres and Redis on a third node, abuse limits disabled for the test.

πŸ’‘ Suggested fix

Inject proofForPassword in POST /v1/account, the Users module (Base::createUser(), password update) and the login rehash instead of constructing a default ProofsPassword/Argon2. If 64 MiB/4/3 is the intended setting, set it in proofForPassword instead, so all paths agree. Optionally rehash on login when the stored hashOptions differ from the current ones (not only when the algorithm differs), so existing users converge.

Context: #10667 reset the options once before; utopia-php/auth 86927a8 ("Fix option keys", Oct 2025) is the change that made the options actually reach password_hash().

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find a similar issue

🏒 Have you read the Code of Conduct?

  • I have read the Code of Conduct

Activity

  1. added
    product / auth
    product / messaging
    on Oct 4, 2026
  2. changed the title [-]πŸ› Bug Report: Sign-up and the Users API hash passwords with 64 MiB / t=4 / p=3 instead of the configured Argon2 parameters (7 MiB / t=5 / p=1) – logins of these users cost ~5Γ— the CPU[/-] [+]πŸ› Bug Report: Sign-up ignores the configured Argon2 parameters[/+] on Oct 4, 2026
  3. added a commit that references this issue on Oct 5, 2026
    6649516
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    product / authproduct / messaging

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions