mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* fix: outlast failed auth cache eviction on credential changes A credential change committed to MongoDB could report success while a cached auth user document without the new credentialsChangedAt stayed readable, so an old OpenID access token kept authorizing until the cache TTL. The Redis-backed auth cache swallowed every failure (Keyv and KeyvRedis resolve a failed GET as a miss and a failed DEL as a no-op), and the eviction helpers stopped at the first error. - The AUTH_USER_DOC namespace opts into throwOnErrors so a failed read or delete is visible; every caller of that namespace already catches. - evictAuthUserDocs attempts every delete even when another fails and reports whether a document may still be served; the data-schemas and packages/api invalidation paths share it. - updateUser waits out AUTH_USER_DOC_CACHE_TTL_MS before returning a credential change whose eviction was incomplete, so the change is only confirmed once no pre-change document can be served. Other updates stay best effort, and later revocations are delayed, never skipped. * fix: record the reverse index before caching an auth user document A document written before its reverse-index entry was cached without an index naming it when the index write failed, so eviction could not find it. Write the index first with a TTL that outlives the documents it names, and skip the document when the index write fails. * test: keep real data-schemas helpers in the pinned order spec * fix: settle the auth cache after revoking reset credentials Waiting out the cache TTL inside updateUser held the reset before its session and passkey revocations, so a live refresh token or passkey could mint an access token issued after credentialsChangedAt during the wait. updateUser is best effort again; awaitAuthUserDocEviction retries the eviction and waits one TTL only when it is still incomplete, and both the web reset controller and the reset CLI call it after revoking sessions and passkeys, before confirming the reset. * fix: settle the credential barrier with a margin and on CLI revocation errors Timers can fire a millisecond early, so the eviction barrier now waits the cache TTL plus a 100 ms margin. The reset CLI also settles the barrier when revoking passkeys or sessions throws, since the password is already changed. * fix: treat an auth cache that cannot delete as not evicted * fix: keep the reverse index until every document it names is evicted A failed eviction still deleted the reverse index, so the credential barrier's retry found no index and reported the cache clear while the documents an unreadable index or a failed delete left behind stayed cached. The index is now deleted only after it was read and every document it names is gone, so a retry can still find what remains. * fix: treat a malformed auth reverse index as unreadable * fix: treat a reverse index with a non-string entry as unreadable |
||
|---|---|---|
| .. | ||
| banViolation.js | ||
| banViolation.spec.js | ||
| clearPendingReq.js | ||
| getLogStores.js | ||
| index.js | ||
| logViolation.js | ||