LibreChat/packages/api
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
..
openapi ⬆️ feat: Migrate to Zod v4 (#17442) 2026-10-26 14:16:22 +01:00
src 🛂 fix: Only Hand Out OpenID Access Tokens the Bearer Verifier Accepts (#17904) 2026-11-08 23:40:21 +01:00
types
.gitignore
babel.config.cjs
jest.config.mjs 🦿 chore: Bump Agents SDK to 4.2.1 (#17664) 2026-10-31 15:17:05 -04:00
jest.setup.cjs
package.json 🪰 chore: Bump HTTP Dependencies and Scope Security Overrides (#17688) 2026-11-05 05:35:17 -05:00
tsconfig.build.json
tsconfig.json 🚸 fix: Align Image Authorization and Static Serving Paths (#17392) 2026-10-24 09:18:19 +02:00
tsconfig.openapi.json
tsconfig.spec.json
tsdown.config.mjs 🔐 fix: Hash Passwords on a Worker Pool and Surface API Key Lookup Failures (#17261) 2026-10-19 22:13:31 +02:00