LibreChat/api/server
Claude a0b38c3196
🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate
Four review rounds found thirteen issues, all one class: a boundary the
permission check had not been copied into. Rounds 2 and 3 each found gaps
created by the previous round's fix, and a manual sweep of tool constructors
and upload routes still missed the `codeEnvAvailable` family entirely — because
the thing worth enumerating is not "paths that reach a tool" but "reads of the
capability".

There are 28 such reads. This replaces per-site permission checks with one
resolution per request, pairs every read that is a gate, and pins the list so a
new one cannot be added silently.

- `resolveToolRoleGrants` resolves `RUN_CODE` and `FILE_SEARCH` together and
  memoizes on the request. Both perf findings disappear by construction: gates
  share one role read instead of each issuing its own.

- Newly paired gates: `codeEnvAvailable` in the OpenAI-compatible, Responses and
  memory-agent initializers (`initializeAgent` rebuilds `bash_tool`, `read_file`
  and the workspace file tools from it, and hands their handlers the code
  environment); the capability checks in agent upload processing and in
  agent-management upload purposes; and the library chat-completion service,
  behind an optional `getRoleByName` dependency so embedders are not broken.

- The v1 Knowledge upload posts `assistant_id` with no `tool_resource`, so there
  is no resource to authorize. It now reads the assistant's own native tools and
  requires their grants, instead of treating a missing resource as unrestricted.

- The startup role read moved off the critical path into the existing
  `Promise.all`, and the direct tool-call check passes `req` so the shared
  loader gate reuses its result rather than repeating the lookup.

- `toolCapabilityGates.spec.js` pins every file that reads either capability
  with a count and a reason. A new read fails the suite until it is classified,
  so the next boundary announces itself instead of waiting for a reviewer.
2026-09-07 04:50:22 +00:00
..
controllers 🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate 2026-09-07 04:50:22 +00:00
middleware 🛅 feat: Add Agent File Management APIs (#15666) 2026-09-06 14:35:34 -04:00
routes 🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate 2026-09-07 04:50:22 +00:00
services 🔐 fix: Resolve Tool Grants Once Per Request and Pair Every Capability Gate 2026-09-07 04:50:22 +00:00
utils 🧺 fix: Contain Conversation Import and Upload Failures (#15681) 2026-09-06 22:42:46 -04:00
cleanup.js
csp.spec.js
experimental.js 🩻 feat(insights): Scope Insights to Authorized Agents (#15549) 2026-09-04 20:16:58 -04:00
experimental.spec.js 🛎️ fix: Start Code Environment Reconciliation After Mongo Connects (#15620) 2026-09-04 19:08:44 -04:00
index.js 🩻 feat(insights): Scope Insights to Authorized Agents (#15549) 2026-09-04 20:16:58 -04:00
index.metrics.spec.js
index.spec.js 🛎️ fix: Start Code Environment Reconciliation After Mongo Connects (#15620) 2026-09-04 19:08:44 -04:00
socialLogins.js
socialLogins.spec.js
telemetry.js 🪵 feat: Add OpenTelemetry Logs Pipeline via Winston Bridge (#15565) 2026-09-03 21:16:09 -04:00
telemetry.spec.js 🪵 feat: Add OpenTelemetry Logs Pipeline via Winston Bridge (#15565) 2026-09-03 21:16:09 -04:00