LibreChat/api/server/routes
Marco Beretta 2ad2c1c14b
🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466)
* perf: Serve JWT Bearer User Lookups From the Auth User Cache

* perf: Batch Agent Permission Reads on the File Access Path

* perf: Remember a Loaded Google Service Key Across Endpoint Config Reads

* perf: Run Independent Startup, Tool, Skill and Erasure Reads Concurrently

* fix: Drop JWT User Cache Writes That Race a User Mutation

Confirm each cache write with a second read and evict when the user changed,
so an in-flight lookup cannot repopulate an entry a credential change just
evicted. The cache mode now arrives through the loader dependencies.

* refactor: Move Agent Skill Access Reads Into packages/api

The chat-completions and Responses controllers call loadSkillAccess instead of
orchestrating the three reads in CJS. The preview route spec mocks the batched
file access helper the middleware now calls.

* test: Cover Agent File Access, JWT Bursts and Remote Skill Reads End to End

* fix: Serve a Cached JWT User Only While Its updatedAt Is Current

A cache hit now reads the stored updatedAt and deletion fence instead of the
fence alone, so a document cached from a read that raced a user mutation is
never served, even when the write landed after that mutation's eviction.

* refactor: Move Startup Migration Checks Into packages/api

* refactor: Inject the Startup Migration Checks Instead of Mongoose Models

* fix: Serve Cached OpenID Users Only While Their updatedAt Is Current

Moves the freshness check into getCurrentCachedAuthUserDoc and uses it on the
OpenID bearer path as well as the local JWT one, so a document cached from a
read that raced a credential or role change is never served there either.

Fixes berry-13/LibreChat#432

* fix: Compare Authorization Fields on Every Auth Cache Hit

updatedAt has millisecond resolution, so the freshness read also compares the
token retirement stamps, role, tenant and two-factor state.

* fix: Annotate the Auth Freshness Projection for Isolated Declarations

* perf: Reuse the OpenID Cache Freshness Read for Deletion Admission

A cache hit already proved the deletion fence is clear, so only users read from
the database take the separate fence query.

* refactor: Keep the OpenID Cache Freshness and Fence Decisions in packages/api

* test: Exercise JWT Cache Freshness Against Real User Methods in MongoDB

* fix: Stamp the JWT User Lookup So the Cache Write Fence Applies

* fix: Reload a Google Service Key File When It Changes or Disappears

The availability check remembers a loaded key only while the file's mtime and
size are unchanged, and fetches URL sources every time as before.

* fix: Recheck a Service Key File After a Permission Change
2026-10-30 00:24:08 +01:00
..
__test-utils__ 🩰 fix: Keep Subagent Guidance in Main Chat Order (#17394) 2026-10-24 12:12:57 +02:00
__tests__ 🗂️ perf: Index Hot Lookups and Fix the Message Cursor (#17464) 2026-10-28 00:55:02 +01:00
admin 🔐 fix: Keep the Admin OpenID State So PKCE Holds When the IdP Omits S256 (#17478) 2026-10-28 18:33:12 +01:00
agents ⛲ feat: Resolve Native and Langfuse Prompts by Source (#16909) 2026-10-24 13:47:52 +02:00
assistants ✒️ fix: Bind Assistant Avatar Updates to Authorized Owners (#17391) 2026-10-24 10:16:16 +02:00
files 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
accessPermissions.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
accessPermissions.sharePolicy.test.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
accessPermissions.test.js
actions.js ⏱️ fix: Bound Outbound Calls Made Inside a Request (#17263) 2026-10-21 19:10:13 +02:00
apiKeys.js
auth.2fa-ratelimit.test.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
auth.cloudfront.test.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
auth.cross-site.test.js 🔐 feat: Enforce Required Two-Factor Authentication (#14731) 2026-10-01 23:39:51 +02:00
auth.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
auth.reset-password-ratelimit.test.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
balance.js
banner.js
categories.js
code-environments.js 🧑‍✈️ feat: Enroll Machines Through Explicit Browser Approval (#17344) 2026-10-22 16:54:00 +02:00
code-environments.test.js 🧑‍✈️ feat: Enroll Machines Through Explicit Browser Approval (#17344) 2026-10-22 16:54:00 +02:00
config.js 🪶 fix: Time Out Client Refresh and Trim Lodash Imports (#17467) 2026-10-27 23:30:08 +01:00
convos.js 🩰 fix: Keep Subagent Guidance in Main Chat Order (#17394) 2026-10-24 12:12:57 +02:00
endpoints.js 🎚️ feat: Filter OpenRouter Reasoning Efforts by the Selected Model (#16808) 2026-10-08 18:04:13 +02:00
index.js 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
insights.js
keys.js 🔏 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
mcp.js 🫢 fix: Keep OAuth Credentials Out of Logs (#17409) 2026-10-24 09:43:06 +02:00
memories.js
memories.test.js
messages.js 🗂️ perf: Index Hot Lookups and Fix the Message Cursor (#17464) 2026-10-28 00:55:02 +01:00
models.js
oauth.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
oauth.state.test.js
oauth.test.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
openapi.js
presets.js
presets.test.js
projects.js 🎒 feat: Carry Project Context Across Conversations (#15684) 2026-10-01 03:46:19 +00:00
prompts.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
prompts.test.js 🎴 feat: Use Langfuse Prompts from Cards and the Slash Command (#17104) 2026-10-24 13:51:01 +02:00
pullRequests.js 🔑 feat: Let Users Connect Their Own Account for Pull Request Lookups (#16989) 2026-10-12 15:58:23 +02:00
roles.js 📜 feat: Audit Admin Role, Group, Config and IdP Role Mutations (#17052) 2026-10-14 23:57:07 +02:00
rum.js feat: add masked session replay lifecycle (#17194) 2026-10-21 14:51:15 -04:00
schedules.js 🦫 feat: Enforce Scheduled MCP Read-Only Authority (#16681) 2026-10-03 20:39:43 -04:00
search.js
settings.js
share.js 🪶 perf: Load Tool-Call Previews and Fetch Full Parts on Demand (#16753) 2026-10-05 07:42:45 -04:00
skills.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
skills.tenant.test.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
skills.test.js 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
static.js
tags.js
traces.js
user.js 🏨 fix: Restore Strict Tenant Startup and Sign-In (#17441) 2026-10-26 01:08:30 +01:00
user.verify-ratelimit.test.js 📧 feat: add email address change (#14597) 2026-10-01 03:46:16 +00:00