LibreChat/packages/api/src/auth
Marco Beretta 76c25680ce
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Has been cancelled
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been cancelled
🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504)
* fix: Retire Credentials by Their Committing Write and on Opt-In 2FA

Re-date password reset and enrollment cutoffs once the write that set them commits, so a credential minted while the write is in flight is retired. Opt-in 2FA confirmation now stamps twoFactorEnrolledAt and rotates the session like required enrollment. OpenID refresh ends a session established before a reset or enrollment instead of spending its IdP grant.

* fix: Bind Opt-In 2FA Rotation to the Caller's Refresh Session

Confirmation now requires the refresh session the request was issued with, rotates it in place and revokes only the others, so an access token on its own cannot trade enrollment for a long-lived session. The OpenID retirement check moves into the refresh recovery service and ends the session through the existing session-missing path, leaving the CJS controller unchanged.

* fix: Clear a Retired OpenID Session Against the User It Was Checked For

* refactor: Inject the Refresh Secret Into OpenID Recovery

* fix: Report a Reset Whose Cutoff Could Not Be Re-Dated

A failed re-stamp now propagates as RETIREMENT_RESTAMP_FAILED. The reset controller still revokes sessions and passkeys and answers CREDENTIAL_RETIREMENT_INCOMPLETE; the CLI re-stamps after its revocations and exits non-zero; enrollment revokes sessions before the re-stamp and mints nothing when it fails.

* fix: Re-Date the Reset Cutoff Only After the Link Is Consumed

The web reset re-stamps credentialsChangedAt in the controller once resetPassword has committed, consumed the token and sent the notice, so a failed re-stamp can no longer leave the link replayable. Revocations still run and the response reports CREDENTIAL_RETIREMENT_INCOMPLETE.

* fix: Retire Credentials on Every Exit Path After a Reset Commits

resetPasswordWithToken owns the post-commit steps: deleting the link and sending the notice no longer throw, and a link issued before the account's last credentialsChangedAt is refused, so it is spent even when its deletion fails. The reset write is conditioned on the cutoff it read, so one link commits once. The controller re-dates the cutoff and revokes sessions and passkeys whenever the password changed, and answers CREDENTIAL_RETIREMENT_INCOMPLETE if any of that fails.

* fix: Spend Undated Reset Links and Move the Reset Notice Into TypeScript

* fix: Tell the User When a Reset Could Not Sign Out Every Session

The reset page now recognizes CREDENTIAL_RETIREMENT_INCOMPLETE, shared from librechat-data-provider, and shows a localized warning that the new password is active with a sign-in action, instead of reporting the spent link as invalid.

* perf: Re-Date the Reset Cutoff From the Committed Write

The committed reset hands its credentialsChangedAt back through PasswordResetResult, so the controller re-stamps without a second user read.

* fix: Retire Every Superseded Credential Before Minting on 2FA Enrollment

Opt-in confirmation and setup finalization now revoke sessions, re-date twoFactorEnrolledAt and wait for the auth cache to drop the pre-enrollment document, running every step even when one fails. If any step fails they mint nothing and answer CREDENTIAL_RETIREMENT_INCOMPLETE; the settings dialog keeps 2FA on with a warning and the setup screen sends the user back to sign in with the new factor.

* test: Cover the Settings Warning When 2FA Enrollment Leaves Sessions Behind

* fix: Send the User Back to Sign In After an Incomplete Opt-In Enrollment

Enrollment retires the confirming tab's bearer, and an incomplete retirement mints no replacement, so the settings dialog now shows the backup codes and then signs out to the login page, whether the user completes setup or closes the dialog.

* test: Run the Retirement Warning Scenarios Against Their Own Signed-Out or Fresh Accounts

* test: Open the Sidebar Drawer Before the Account Menu on Phones

* fix: Report a Committed Opt-In Enrollment When Rotating the Session Fails

Once 2FA is promoted, a later failure in confirm2FA withdraws whatever session it may have minted and answers CREDENTIAL_RETIREMENT_INCOMPLETE, so the settings dialog hands over the backup codes and signs the user in again instead of reporting an invalid code.

* test: Prove an Incomplete Reset Does Not Resume the Retired Session

The Sign in action sends a browser with a live session through /login for about 150 ms before it lands in chat, so the signed-in version of the warning scenario only passed when the URL check caught that window. The warning scenario runs signed out, and a new scenario holds a pre-reset session and asserts its refresh is refused and the user stays on the login page.

* fix: Settle the Auth Cache After the CLI Reset's Final Cutoff Write

* test: Require the Login Form After Signing In From a Signed-Out Reset

* fix: Explain an Incomplete Session Retirement Before Restarting Sign-In After Required 2FA Setup

* perf: Start the Opt-In Enrollment User and Session Reads Together
2026-11-05 22:53:11 +01:00
..
__fixtures__ 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00
openid 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
passkey 🗂️ feat: Audit MCP, Code Worker, Langfuse, Skill Credential, Passkey and Audit Log Access (#17054) 2026-10-15 00:30:26 +02:00
adminPkce.spec.ts 🔐 fix: Keep the Admin OpenID State So PKCE Holds When the IdP Omits S256 (#17478) 2026-10-28 18:33:12 +01:00
agent.spec.ts
agent.ts
allowedAddresses.ts ✂️ refactor: Remove Dead Helpers, Classes and Dependencies From packages/api (#17118) 2026-10-16 15:43:12 +02:00
codeapi.spec.ts 🪵 fix: Log Code API Auth Header Failures With Request Context (#15592) 2026-09-04 10:38:49 -04:00
codeapi.ts 🧑‍✈️ feat: Enroll Machines Through Explicit Browser Approval (#17344) 2026-10-22 16:54:00 +02:00
credentials.eviction.spec.ts 🧊 fix: Fence Auth User Cache Writes After Eviction and Evict Favorite Holders (#17505) 2026-10-29 17:44:51 +01:00
domain.spec.ts
domain.ts 🔁 fix: Recover Concurrent First SAML, LDAP and Social Logins (#16779) 2026-10-05 17:57:23 -04:00
email.spec.ts 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00
email.ts 🕵️ fix: Redact Email Addresses and IPs From Auth Flow Logs (#16994) 2026-10-12 10:50:56 +02:00
emailChangeStore.spec.ts 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00
emailChangeStore.ts 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00
enrollment.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
exchange.spec.ts 🧧 fix: Redeem Admin OAuth Codes Only Once (#16513) 2026-09-29 12:09:13 -04:00
exchange.ts 🔐 fix: Keep the Admin OpenID State So PKCE Holds When the IdP Omits S256 (#17478) 2026-10-28 18:33:12 +01:00
gates.spec.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
gates.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
googleRefresh.spec.ts
googleRefresh.ts ⏱️ fix: Bound Remaining Outbound Calls With Timeout Budgets (#17468) 2026-10-29 09:55:18 +01:00
hash-worker.ts 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00
hashing.spec.ts 🔕 fix: Quiet Client Disconnects, Fall Back When Hash Workers Fail, Log Speech Truncation (#17278) 2026-10-20 10:47:15 +02:00
hashing.ts 🔕 fix: Quiet Client Disconnects, Fall Back When Hash Workers Fail, Log Speech Truncation (#17278) 2026-10-20 10:47:15 +02:00
index.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
invite.spec.ts
invite.ts
ip.ts
jwt.integration.spec.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
jwt.spec.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
jwt.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
ldap.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
limiter.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
localRefresh.ts 🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926) 2026-10-14 11:08:53 +02:00
login.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
oidc.cognito.spec.ts 🔐 feat: Support Cognito Access Tokens for Agent Management (#16224) 2026-09-22 20:37:40 -04:00
oidc.spec.ts 🔐 feat: Support Cognito Access Tokens for Agent Management (#16224) 2026-09-22 20:37:40 -04:00
oidc.ts 🔐 feat: Support Cognito Access Tokens for Agent Management (#16224) 2026-09-22 20:37:40 -04:00
openid.spec.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
openid.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
openidRoleSync.spec.ts 📜 feat: Audit Admin Role, Group, Config and IdP Role Mutations (#17052) 2026-10-14 23:57:07 +02:00
openidRoleSync.ts 🪶 fix: Time Out Client Refresh and Trim Lodash Imports (#17467) 2026-10-27 23:30:08 +01:00
passkey.spec.ts ⚙️ feat: Make the Per-User Passkey Cap Configurable (#16259) 2026-10-01 03:46:17 +00:00
passkey.ts ⚙️ feat: Make the Per-User Passkey Cap Configurable (#16259) 2026-10-01 03:46:17 +00:00
password.ts
passwordReset.spec.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
passwordReset.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
passwordResetUpdate.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
provision.spec.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
provision.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
proxy.ts
recovery.spec.ts 🔏 fix: Encrypt Provider Keys With v3, Reject Plaintext in decryptV2 and Default to Strong Backup Codes (#17051) 2026-10-13 22:19:37 +02:00
recovery.ts 🔏 fix: Encrypt Provider Keys With v3, Reject Plaintext in decryptV2 and Default to Strong Backup Codes (#17051) 2026-10-13 22:19:37 +02:00
refresh.spec.ts 📧 fix: Log User IDs Instead of Emails in Admin Panel Auth Flow (#17032) 2026-10-13 08:42:57 +02:00
refresh.ts 📧 fix: Log User IDs Instead of Emails in Admin Panel Auth Flow (#17032) 2026-10-13 08:42:57 +02:00
retirement.spec.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
reuse.spec.ts
reuse.ts
saml.spec.ts
saml.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
share.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
social.ts 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
tempuser.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
twoFactor.spec.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
twoFactor.ts 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
user.spec.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
user.ts 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
userDocCache.spec.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
userDocCache.ts 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
verification.spec.ts 🔑 feat: Passkey Authentication with WebAuthn Sign-In and Management (#14715) 2026-10-01 03:46:16 +00:00
verification.ts 🔑 feat: Passkey Authentication with WebAuthn Sign-In and Management (#14715) 2026-10-01 03:46:16 +00:00