LibreChat/api/server/services/Files
Danny Avila ad08df4db6
🔏 fix: Scope Agent-Author File Access to Attached Files Only (#12251)
* 🛡️ fix: Scope agent-author file access to attached files only

The hasAccessToFilesViaAgent helper short-circuited for agent authors,
granting access to all requested file IDs without verifying they were
attached to the agent's tool_resources. This enabled an IDOR where any
agent author could delete arbitrary files by supplying their agent_id
alongside unrelated file IDs.

Now both the author and non-author paths check file IDs against the
agent's tool_resources before granting access.

* chore: Use Object.values/for...of and add JSDoc in getAttachedFileIds

* test: Add boundary cases for agent file access authorization

- Agent with no tool_resources denies all access (fail-closed)
- Files across multiple resource types are all reachable
- Author + isDelete: true still scopes to attached files only
2026-03-15 18:54:34 -04:00
..
Audio 🔊 fix: Validate language format for OpenAI STT model (#10875) 2025-12-09 22:25:45 -05:00
Azure 🔧 feat: deleteRagFile utility for Consistent RAG API document deletion (#11493) 2026-02-14 13:57:01 -05:00
Citations 🔍 fix: Display File Search Citations Based on Permissions (#9454) 2025-09-05 09:14:55 -04:00
Code 🧹 fix: Sanitize Artifact Filenames in Code Execution Output (#12222) 2026-03-14 03:09:26 -04:00
Firebase 🔧 feat: deleteRagFile utility for Consistent RAG API document deletion (#11493) 2026-02-14 13:57:01 -05:00
images 🔥 fix: Firebase Support for Nano Banana Tool (#11228) 2026-01-06 11:19:38 -05:00
Local 🧹 fix: Sanitize Artifact Filenames in Code Execution Output (#12222) 2026-03-14 03:09:26 -04:00
OpenAI 🧹 chore: Cleanup Logger and Utility Imports (#9935) 2025-10-01 23:30:47 -04:00
S3 🪣 fix: S3 path-style URL support for MinIO, R2, and custom endpoints (#11894) 2026-02-21 18:36:48 -05:00
VectorDB 📎 feat: Upload as Text Support for Plaintext, STT, RAG, and Token Limits (#8868) 2025-08-27 03:44:39 -04:00
index.js 🏪 feat: Agent Marketplace 2025-08-13 16:24:18 -04:00
permissions.js 🔏 fix: Scope Agent-Author File Access to Attached Files Only (#12251) 2026-03-15 18:54:34 -04:00
process.js 🧩 feat: OpenDocument Format File Upload and Native ODS Parsing (#11959) 2026-02-26 14:39:49 -05:00
process.spec.js 🧩 feat: OpenDocument Format File Upload and Native ODS Parsing (#11959) 2026-02-26 14:39:49 -05:00
strategies.js 📄 feat: Local Text Extraction for PDF, DOCX, and XLS/XLSX (#11900) 2026-02-22 14:22:45 -05:00