LibreChat/api/server/controllers/auth
Marco Beretta 4c6ea7e981
🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261)
* fix: Hash Off the Event Loop and Surface API Key Lookup Failures

Registration, email verification, password reset and verification resends
hashed and compared with bcryptjs's synchronous calls. bcryptjs is pure
JavaScript, so each call blocked the event loop for every request in the
process. They now use the promise APIs, and the password reset
dependencies are async.

validateAgentApiKey caught its own query failures and returned null, so a
database outage answered remote callers with 401 Invalid API key. It now
lets the failure reach requireApiKeyAuth, which answers with a 500.

* fix: Run bcrypt on a Worker Pool in packages/api

bcryptjs's promise API still computes on the main thread, only in chunks
of up to 100 ms, so concurrent registrations and resets kept stalling
unrelated requests (four cost-10 hashes delayed a 5 ms timer by about
190 ms). hashSecret and compareSecret now run bcryptjs on a small
worker_threads pool in packages/api, and AuthService.js calls them.

* feat: Configure the Password Hashing Worker Count

* fix: Verify Login and Step-Up Passwords on the Hash Pool
2026-10-19 22:13:31 +02:00
..
LoginController.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
LoginController.spec.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
LogoutController.js 🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926) 2026-10-14 11:08:53 +02:00
LogoutController.spec.js 🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926) 2026-10-14 11:08:53 +02:00
oauth.js 📧 fix: Log User IDs Instead of Emails in Admin Panel Auth Flow (#17032) 2026-10-13 08:42:57 +02:00
oauth.spec.js
PasskeyController.js 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00
PasskeyController.spec.js 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00
TwoFactorAuthController.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
TwoFactorAuthController.spec.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00