LibreChat/api/server/services
Danny Avila 0abbf3313d
🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351)
* 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links

Sign-in decisions made before the user is known now read librechat.yaml plus the `__base__`
override of the request's tenant, or of the deployment outside a tenant, and fail closed
(`resolvePreAuthAppConfig`). Registration, the first phase of password reset and the first
email-domain check of the LDAP, OpenID, SAML and social strategies use it. The second check
applies the account's role overrides with or without a tenant, and a new account is checked
against the role it will be created with before anything is inserted. OpenID checks again when
the admin claim or role sync changes the role. Password reset issues no link when the
account's config cannot be read.

The signed-out `GET /api/config` serves Base `registration.socialLogins` and the pre-login
interface fields (`resolvePreLoginAppConfig`), falling back to librechat.yaml when overrides
cannot be read. `turnstile` becomes a base-only section, so Turnstile comes only from
librechat.yaml.

Config reads that merge documents stay in one tenant partition (`tenantPartition`, Mongoose
binding `tenantPartitionFilter`): the active tenant's documents, or the tenantless ones outside
a tenant. The config store's Mongoose binding reads, writes, lists and restores role documents,
`__base__` included, in that partition, and its `listActive` draws every document from it;
group and user documents stay addressed by id. Only a `list` with `acrossTenants` reads every
partition, which `listConfigTombstones` uses so the startup MCP tombstone report still names
each tenant's documents. The tenant-isolation conformance suite gains single-partition cases.

Privacy policy and terms of service `externalUrl` must be http(s), `mailto:`, `tel:`, relative
or blank (`isSafeLinkUrl`). Admin writes of another scheme are refused, a librechat.yaml link is
dropped with a warning at load, a stored one is dropped at merge, and every payload and the
client remove one that reaches them. The admin config meta reports
`features.preAuthBaseOverrides: true`.

* 🧪 test: Layer a Required-Field Override Through interface.currency Instead of Turnstile

Turnstile is set in librechat.yaml only now, so profile overrides of it are skipped and the
layering scenario could no longer see a role's Turnstile options completed by a user's site key.
The scenario now layers `interface.currency`, whose `code` and `rate` are both required: the role
stores only the rate, the user only the code, and /api/config serves both.

* 🛂 fix: Admit a First OpenID Login Under Its Claimed Role Before Creating the Account

The admin-role claim and role sync are now decided before a first-login OpenID account is created, and createUserOnce admits the email under that role's config, read in parallel with the USER role's, before inserting anything. A login the claimed role refuses creates no account and no start balance. Admitted logins are unchanged: the account is still created as USER (now explicitly), moved into the claimed role, re-checked and audited as before, with the claims decided once. An account a concurrent first login created gets the claims decided again for its own role and tenant.
2026-10-22 22:49:54 +02:00
..
__tests__ 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
Agents 🔗 feat: use LibreChat prompt groups as agent instructions (#16686) 2026-10-04 21:27:26 -04:00
Artifacts
Config 🗄️ refactor: Portable Admin Config Store with Revisions, Key Encoding and Coherent Writes (#17326) 2026-10-22 13:04:35 +02:00
Endpoints 🏷️ fix: Resolve endpoints.all Title Settings per Field and Fold Ollama Endpoint Names (#17316) 2026-10-22 16:57:42 +02:00
Files 🪏 fix: Restore Explicit File Search Uploads (#17226) 2026-10-21 23:53:29 +02:00
MCP 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
Runs 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
Schedules 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
Skills 🔌 feat: Integrate Durable Skill Lifecycle Across Writers and Routes (#17043) 2026-10-16 09:05:05 -07:00
start 🔎 perf: Index-Bound Word-Prefix Search for Users and Groups (#16719) 2026-10-16 22:41:37 +02:00
Threads ⚡ perf: Async Local File Saves and Compile Hot-Path Regexes Once (#16712) 2026-10-04 15:52:55 -04:00
Tools 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
ActionService.js ⏱️ fix: Bound Outbound Calls Made Inside a Request (#17263) 2026-10-21 19:10:13 +02:00
ActionService.spec.js ⏱️ fix: Bound Outbound Calls Made Inside a Request (#17263) 2026-10-21 19:10:13 +02:00
AssistantService.js 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
AuthService.js 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
AuthService.spec.js 🔐 fix: Apply Base Config Overrides Before Sign-In and Refuse Script Policy Links (#17351) 2026-10-22 22:49:54 +02:00
createRunBody.js
createRunBody.spec.js
GraphApiService.js 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
GraphApiService.spec.js 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
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: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
initializeOAuthReconnectManager.spec.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04: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 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
MCPAuthorizationFenceRetry.spec.js 🛂 fix: Back Off MCP OAuth Discovery (#15783) 2026-09-09 22:21:34 -04:00
MCPRequestContext.js
OboPolicyService.js
OboTokenService.js 🙈 fix: Mask Emails and Drop Personal Identifiers From Logs (#17048) 2026-10-15 15:54:27 +02:00
OboTokenService.spec.js
OpenIDRefreshFlight.js
OpenIDRefreshFlight.spec.js
OpenIDRefreshRecovery.js
OpenIDSessionRefresh.js
OpenIDSessionRefresh.spec.js 🪪 fix: Boot-Paint a Cached Theme Only for Its Signed-In Owner (#16926) 2026-10-14 11:08:53 +02:00
PermissionService.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
PermissionService.spec.js 🛂 feat: Audit Resource Sharing Changes and Fail Closed on Reversible Audit Writes (#17053) 2026-10-15 00:30:16 +02:00
PluginService.js 🪦 refactor: Remove Dead Legacy API Modules and Root Tooling (#17114) 2026-10-15 12:25:24 +02:00
PluginService.spec.js 🔐 fix: Encrypt User Plugin Credentials With Random-IV v3 Format (#16996) 2026-10-12 16:33:08 +02:00
RefreshTokenBridge.js
RefreshTokenBridge.spec.js
systemGrant.spec.js
ToolService.js 🙈 feat: Let Config Profiles Hide librechat.yaml MCP Servers and Remove Their Fields (#17327) 2026-10-22 14:10:31 +02:00
twoFactorService.js 🗝️ fix: Strengthen Two-Factor Recovery Credentials (#16742) 2026-10-04 12:16:37 -04:00
twoFactorService.spec.js 🗃️ refactor: Remove Dead Data Schemas Methods and Data Provider Exports (#17113) 2026-10-15 12:23:29 +02:00