mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-27 04:07:05 +00:00
🧾 fix: Harden Historical File Authorization (#13918)
* fix: Harden historical file authorization * chore: Sort file authorization imports * fix: Preserve authorized historical artifact refs * chore: Format historical artifact hardening
This commit is contained in:
parent
606292c5c5
commit
1eb460eb03
11 changed files with 755 additions and 74 deletions
|
|
@ -305,10 +305,14 @@ const pruneToolResourceFileIdsForOwner = async ({ tool_resources, ownerId, logPr
|
|||
const ownerIdStr = ownerId.toString();
|
||||
|
||||
try {
|
||||
const ownerFiles = await db.getFiles({ file_id: { $in: referencedFileIds } }, null, {
|
||||
file_id: 1,
|
||||
user: 1,
|
||||
});
|
||||
const ownerFiles = await db.getFiles(
|
||||
{ file_id: { $in: referencedFileIds }, user: ownerIdStr },
|
||||
null,
|
||||
{
|
||||
file_id: 1,
|
||||
user: 1,
|
||||
},
|
||||
);
|
||||
const allowedIds = new Set(
|
||||
(ownerFiles ?? [])
|
||||
.filter((file) => file.user && file.user.toString() === ownerIdStr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue