LibreChat/packages/data-provider/src
René Mulder c80c54eefb
🔐 fix: Resolve Env Variables in MCP OAuth URL Fields (#13573)
* fix: resolve env variables in MCP OAuth URL fields before validation

Apply the extractEnvVariable transform to authorization_url, token_url,
redirect_uri, and revocation_endpoint in OAuthOptionsBaseSchema. Without
this, ${ENV_VAR} syntax in these fields caused a Zod URL validation error
at startup before any env substitution could happen.

The same .transform().pipe() pattern is already used on all transport url
fields (SSE, WebSocket, StreamableHTTP) and ProxyUrlSchema.

Closes #13572

* fix: block env var expansion in user OAuth URL fields

Override redirect_uri and revocation_endpoint in UserOAuthOptionsSchema
with userOAuthEndpointUrlSchema, matching the existing overrides for
authorization_url and token_url. Without this, user-submitted configs
could inherit the extractEnvVariable transform added to the base schema
and resolve env vars like ${OPENAI_API_KEY} in those fields.

Add envVarPattern rejection to userOAuthEndpointUrlSchema so that
valid-URL-shaped payloads containing ${VAR} patterns are also blocked,
not just bare non-URL strings. Move envVarPattern declaration above the
schema to make it available at module evaluation time.

Add regression tests for all four OAuth URL fields on the user path,
using structurally valid URLs with embedded ${VAR} patterns to confirm
it is the env var guard — not URL shape — that rejects them.
2026-06-07 21:39:44 -04:00
..
react-query 📸 refactor: Refresh Shared Links With Latest Snapshot (#13095) 2026-05-13 19:38:28 -04:00
types 📻 fix: Replay MCP OAuth Prompts for Coalesced Connections (#13565) 2026-06-07 10:45:54 -04:00
accessPermissions.ts 🔗 feat: Add Granular Access Control to Shared Links via ACL System (#13051) 2026-06-03 14:17:17 -04:00
actions.ts 🛡️ fix: Implement TOCTOU-Safe SSRF Protection for Actions and MCP (#11722) 2026-02-11 22:09:58 -05:00
api-endpoints.ts 🗂️ feat: Add Private Chat Projects (#13467) 2026-06-03 15:29:18 -04:00
artifacts.ts 🪟 fix: Windows Build (npm) (#3889) 2024-09-02 10:01:09 -04:00
azure.ts 🔃 refactor: Decouple Effects from AppService, move to data-schemas (#9974) 2025-10-05 06:37:57 -04:00
balance.spec.ts ⏱️ fix: Align Auto-Refill Next Date (#12980) 2026-05-06 21:40:18 -04:00
balance.ts ⏱️ fix: Align Auto-Refill Next Date (#12980) 2026-05-06 21:40:18 -04:00
bedrock.ts 🗂️ feat: Add Private Chat Projects (#13467) 2026-06-03 15:29:18 -04:00
cloudfront-config.spec.ts 🌩️ feat: Strict CloudFront signed cookie enforcement via requireSignedAccess (#13078) 2026-05-11 23:30:01 -04:00
codeEnvRef.spec.ts 🧱 refactor: typed CodeEnvRef + kind discriminator + principal-aware sandbox cache (#12960) 2026-05-08 12:29:43 -04:00
codeEnvRef.ts 🔐 feat: Mint Code API Auth Tokens (#13028) 2026-05-09 16:09:10 -04:00
config.spec.ts 🪨 fix: Preserve Bedrock Guardrail Config (#13381) 2026-05-28 21:38:53 -07:00
config.ts 🧭 feat: Scope Model Spec Skills (#13522) 2026-06-05 10:22:02 -04:00
createPayload.ts 🎬 feat: Prime Manually-Invoked Skills via $ Popover (#12709) 2026-04-25 04:02:00 -04:00
data-service.ts 👷 ci: Type-check the Client Workspace (#13560) 2026-06-06 18:40:31 -04:00
feedback.ts 📈 feat: Chat rating for feedback (#5878) 2025-05-30 12:16:34 -04:00
file-config.spec.ts 📦 feat: Configure Skill Import Size Limit (#13073) 2026-05-11 16:24:04 -04:00
file-config.ts 📦 feat: Configure Skill Import Size Limit (#13073) 2026-05-11 16:24:04 -04:00
generate.ts feat: Model-Aware Max Output Tokens for Google/Gemini (#13390) 2026-05-29 08:09:32 -07:00
headers-helpers.ts 🍪 refactor: Refresh CloudFront Media Cookies (#13091) 2026-05-12 13:26:05 -04:00
index.ts 🧱 refactor: typed CodeEnvRef + kind discriminator + principal-aware sandbox cache (#12960) 2026-05-08 12:29:43 -04:00
keys.ts 🗂️ feat: Add Private Chat Projects (#13467) 2026-06-03 15:29:18 -04:00
mcp.ts 🔐 fix: Resolve Env Variables in MCP OAuth URL Fields (#13573) 2026-06-07 21:39:44 -04:00
messages.ts 🐛 fix: String Interpolation in Messages Endpoint from #9155 (#9312) 2025-08-27 13:48:48 -04:00
models.ts 🌱 feat: Support Soft Default Model Spec (#13554) 2026-06-06 14:20:59 -04:00
parameterSettings.spec.ts feat: Model-Aware Max Output Tokens for Google/Gemini (#13390) 2026-05-29 08:09:32 -07:00
parameterSettings.ts feat: Model-Aware Max Output Tokens for Google/Gemini (#13390) 2026-05-29 08:09:32 -07:00
parsers.ts 🧭 feat: Add OpenRouter Prompt Cache Setting (#13029) 2026-05-09 11:46:09 -04:00
permissions.ts 🔗 feat: Add Granular Access Control to Shared Links via ACL System (#13051) 2026-06-03 14:17:17 -04:00
request.ts 🧭 fix: Subdirectory Deployment Auth Redirect Path Doubling (#12077) 2026-03-05 01:38:44 -05:00
roles.spec.ts 🔗 feat: Add Granular Access Control to Shared Links via ACL System (#13051) 2026-06-03 14:17:17 -04:00
roles.ts 🔗 feat: Add Granular Access Control to Shared Links via ACL System (#13051) 2026-06-03 14:17:17 -04:00
schemas.spec.ts 🗂️ feat: Add Private Chat Projects (#13467) 2026-06-03 15:29:18 -04:00
schemas.ts 🗂️ feat: Add Private Chat Projects (#13467) 2026-06-03 15:29:18 -04:00
types.ts 📻 fix: Replay MCP OAuth Prompts for Coalesced Connections (#13565) 2026-06-07 10:45:54 -04:00
utils.ts 🧯 fix: Prevent Env-Variable Exfil. via Placeholder Injection (#12260) 2026-03-16 08:48:24 -04:00