LibreChat/api/server/controllers/agents
Danny Avila 381ed8539b
🪪 fix: Enforce Conversation Ownership Checks in Remote Agent Controllers (#12263)
* 🔒 fix: Validate conversation ownership in remote agent API endpoints

Add user-scoped ownership checks for client-supplied conversation IDs
in OpenAI-compatible and Open Responses controllers to prevent
cross-tenant file/message loading via IDOR.

* 🔒 fix: Harden ownership checks against type confusion and unhandled errors

- Add typeof string validation before getConvo to block NoSQL operator
  injection (e.g. { "$gt": "" }) bypassing the ownership check
- Move ownership checks inside try/catch so DB errors produce structured
  JSON error responses instead of unhandled promise rejections
- Add string type validation for conversation_id and previous_response_id
  in the upstream TS request validators (defense-in-depth)

* 🧪 test: Add coverage for conversation ownership validation in remote agent APIs

- Fix broken getConvo mock in openai.spec.js (was missing entirely)
- Add tests for: owned conversation, unowned (404), non-string type (400),
  absent conversation_id (skipped), and DB error (500) — both controllers
2026-03-16 09:19:48 -04:00
..
__tests__ 🪪 fix: Enforce Conversation Ownership Checks in Remote Agent Controllers (#12263) 2026-03-16 09:19:48 -04:00
callbacks.js 🪆 refactor: Internalize Producer Event Handling into Agent Graph Context (#11816) 2026-02-17 00:53:22 -05:00
client.js 🧱 fix: Enforce Agent Access Control on Context and OCR File Loading (#12253) 2026-03-15 23:02:36 -04:00
client.test.js 🪙 feat: Add messageId to Transactions (#11987) 2026-02-27 23:50:13 -05:00
errors.js 🛜 refactor: Streamline App Config Usage (#9234) 2025-08-26 12:10:18 -04:00
filterAuthorizedTools.spec.js 🔏 fix: Enforce MCP Server Authorization on Agent Tool Persistence (#12250) 2026-03-15 20:08:34 -04:00
openai.js 🪪 fix: Enforce Conversation Ownership Checks in Remote Agent Controllers (#12263) 2026-03-16 09:19:48 -04:00
recordCollectedUsage.spec.js 🧮 refactor: Bulk Transactions & Balance Updates for Token Spending (#11996) 2026-03-01 12:26:36 -05:00
request.js 📌 fix: Populate userMessage.files Before First DB Save (#11939) 2026-02-26 09:16:45 -05:00
responses.js 🪪 fix: Enforce Conversation Ownership Checks in Remote Agent Controllers (#12263) 2026-03-16 09:19:48 -04:00
v1.js 🔏 fix: Enforce MCP Server Authorization on Agent Tool Persistence (#12250) 2026-03-15 20:08:34 -04:00
v1.spec.js 🪪 fix: Enforce VIEW ACL on Agent Edge References at Write and Runtime (#12246) 2026-03-15 18:08:57 -04:00