LibreChat/api/server/controllers/agents
Dustin Healy 3ea35af9ad 🛡️ feat: Extend PII filter to OpenAI-compatible and Responses agent APIs
The chat-route middleware operates on `req.body.text`, but the remote
agent API endpoints (`/api/agents/v1/chat/completions`,
`/api/agents/v1/responses`) accept the same prompt content as a
`messages` array or an `input` field. A caller using their API key
could send a credential-shaped value through either route and bypass
the configured PII filter even though they share the same agent and
model backbone the middleware is meant to guard.

Factored out `findPiiMatchInMessages`, a tolerant walker that handles
both `content: string` and `content: ContentPart[]` user-message
shapes against the same compiled, cached pattern list. Wired it into
the OpenAI-compat controller after agent lookup and into the
Responses controller right after `convertToInternalMessages`. Each
returns the endpoint's native 400 error shape
(`sendErrorResponse` / `sendResponsesErrorResponse`) with the
`message_pii_filter_block` code when a user message matches.
2026-06-08 12:24:26 -07:00
..
__tests__ 📻 fix: Replay MCP OAuth Prompts for Coalesced Connections (#13565) 2026-06-07 10:45:54 -04:00
callbacks.js 🗂️ feat: Add Agent File Authoring Tools (#13435) 2026-06-03 23:58:12 -04:00
client.js 🧷 fix: Bind Agent File Context to Current Turn (#13506) 2026-06-04 09:03:43 -04:00
client.test.js 📎 fix: Preserve Provider Document Uploads (#13550) 2026-06-06 10:03:32 -04:00
errors.js 📦 refactor: Consolidate DB models, encapsulating Mongoose usage in data-schemas (#11830) 2026-03-21 14:28:53 -04:00
filterAuthorizedTools.spec.js 🧠 refactor: Memoize MCP Permission Checks Per Request (#13419) 2026-05-30 18:32:06 -04:00
openai.js 🛡️ feat: Extend PII filter to OpenAI-compatible and Responses agent APIs 2026-06-08 12:24:26 -07:00
recordCollectedUsage.spec.js 🪢 chore: Consolidate Pricing and Tx Imports After tx.js Module Removal (#12086) 2026-03-21 14:28:53 -04:00
request.js 📻 fix: Replay MCP OAuth Prompts for Coalesced Connections (#13565) 2026-06-07 10:45:54 -04:00
responses.js 🛡️ feat: Extend PII filter to OpenAI-compatible and Responses agent APIs 2026-06-08 12:24:26 -07:00
v1.js 🧭 fix: Restore Empty Skill Allowlist Catalog (#13526) 2026-06-05 12:30:48 -04:00
v1.spec.js 🧭 fix: Restore Empty Skill Allowlist Catalog (#13526) 2026-06-05 12:30:48 -04:00