Skip to content

Run Argon2 on the blocking pool in request handlers - #118

Merged
fylorn merged 1 commit into
devfrom
fix/argon2-off-runtime
Oct 20, 2026
Merged

fylorn merged 1 commit into
devfrom
fix/argon2-off-runtime

Conversation

@fylorn

@fylorn fylorn commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Login, password changes, admin-created users, password resets and first-run setup hashed or verified passwords with Argon2 directly on the async runtime. Argon2 costs tens of milliseconds of CPU by design, so each call held a worker and stalled every other request scheduled on it.

  • think_watch_auth::password gains hash_password_off_runtime, verify_password_off_runtime and verify_password_or_dummy_off_runtime, which run the existing functions with spawn_blocking.
  • The eight call sites in the server handlers await them. Hash parameters and the constant-time login against a dummy hash are unchanged.
  • CHANGELOG [Unreleased] Fixed entry.

Testing

cargo clippy --workspace --all-targets -D warnings; cargo test -p think-watch-auth -p think-watch-server --lib (new test: the off-runtime versions agree with the blocking ones). Integration tests run in CI.

🤖 Generated with Claude Code

Login, password changes, admin-created users, password resets and
first-run setup hashed or verified passwords with Argon2 directly on
the async runtime, holding a worker for tens of milliseconds per call.
The password module gains off-runtime versions that use spawn_blocking;
the handlers await them. Hash parameters and the constant-time login
against a dummy hash are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit fd13601 into dev Oct 20, 2026
7 checks passed
@fylorn
fylorn deleted the fix/argon2-off-runtime branch October 20, 2026 15:08
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant