LibreChat/api/server/services
Marco Beretta 4bded120a9
🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904)
* fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts

The OpenID reuse path in refreshController and the post-refresh fallback in
getOpenIDAppAuthToken returned the cached access token as the app auth token
whenever its exp was in the future. Entra issues Microsoft Graph access tokens
to sign-in clients by default; their aud names Graph, so the bearer verifier
rejects them and every protected request answers 401 until the client loops.

Both paths now require the access token's aud to name the client id or an
OPENID_AUDIENCE entry, the same audiences the verifier accepts. The reuse path
refreshes with the IdP instead, and the post-refresh fallback keeps opaque
tokens as before. Audience parsing is shared with openIdJwtStrategy.

Related to #17791

* test: Exercise Real OpenID Audience Helpers in AuthService Spec

The AuthService spec stubbed the audience helpers as pass-throughs, so it
could not catch a foreign-audience access token escaping the post-refresh
fallback. Use the real exports and cover Graph-audience, configured-audience
and opaque access tokens through setOpenIDAuthTokens.
2026-11-08 23:40:21 +01:00
..
__tests__ 🚤 fix: Keep Host Tool Loading Independent of Worker Status (#17628) 2026-10-29 22:13:10 +01:00
Agents 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
Artifacts
Config 🪪 feat: Name the Build and Config in Telemetry, Configure Stack Depth, Keep Scoped Frames (#17515) 2026-10-31 11:44:23 -04:00
Endpoints 🏎️ perf: Parallelize Independent Agent and Schedule Lookups (#17465) 2026-10-28 18:59:16 +01:00
Files 🗄️ fix: Skip Attachments Deleted by Storage Retention Instead of Failing the Turn (#17910) 2026-11-08 23:38:47 +01:00
MCP 🔐 fix: Fence ACL Viewers and Surface Revocation Failures When Removing Shared MCP Servers (#17506) 2026-10-28 00:37:07 +01:00
Runs
Schedules
Skills
start 🔑 perf: Cache JWT Users and Batch Auth-Path Reads (#17466) 2026-10-30 00:24:08 +01:00
Threads
Tools 🧯 fix: Guard SSE Writes and Interval Cleanups Against Crashes (#17462) 2026-10-27 23:06:58 +01:00
ActionService.js 🫢 fix: Keep OAuth Credentials Out of Logs (#17409) 2026-10-24 09:43:06 +02:00
ActionService.spec.js 🫢 fix: Keep OAuth Credentials Out of Logs (#17409) 2026-10-24 09:43:06 +02:00
AssistantService.js
AuthService.js 🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904) 2026-11-08 23:40:21 +01:00
AuthService.spec.js 🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904) 2026-11-08 23:40:21 +01:00
createRunBody.js
createRunBody.spec.js
GraphApiService.js
GraphApiService.spec.js
GraphTokenService.js
initializeMCPs.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
initializeMCPs.plugins.spec.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
initializeMCPs.spec.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
initializeOAuthReconnectManager.js 🧯 fix: Guard SSE Writes and Interval Cleanups Against Crashes (#17462) 2026-10-27 23:06:58 +01:00
initializeOAuthReconnectManager.spec.js 🧯 fix: Guard SSE Writes and Interval Cleanups Against Crashes (#17462) 2026-10-27 23:06:58 +01:00
LangfusePromptSync.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
LangfusePromptSync.spec.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
MCP.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
MCP.spec.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
MCPAuthorizationFenceRetry.js
MCPAuthorizationFenceRetry.spec.js
MCPRequestContext.js
OboPolicyService.js
OboTokenService.js
OboTokenService.spec.js
OpenIDRefreshFlight.js
OpenIDRefreshFlight.spec.js
OpenIDRefreshRecovery.js 🔐 fix: Retire Credentials by Their Committing Write and on Opt-In 2FA (#17504) 2026-11-05 22:53:11 +01:00
OpenIDSessionRefresh.js
OpenIDSessionRefresh.spec.js
PermissionService.js
PermissionService.spec.js
PluginService.js
PluginService.spec.js
Prompts.consumers.spec.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
Prompts.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
Prompts.spec.js 🏭 refactor: Centralize Source Prompt Imports in the Prompt Service (#17272) 2026-10-24 13:51:31 +02:00
RefreshTokenBridge.js
RefreshTokenBridge.spec.js
systemGrant.spec.js
ToolService.js 🗄️ fix: Skip Attachments Deleted by Storage Retention Instead of Failing the Turn (#17910) 2026-11-08 23:38:47 +01:00
twoFactorService.js
twoFactorService.spec.js