Q122: reading a recorded file checks its bytes against the recorded hash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f192eabe7
commit
69b83d6b77
11 files changed
+95
-26
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { readVerifiedFile } from "./files/file-object-store";
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import type { CreateChatSpaceInput, DeleteMessageInput, EditMessageInput, MarkChatSpaceReadInput, SendMessageInput } from "../../shared/commands";
|
||||
import {
|
||||
@@ -436,6 +437,8 @@ export class ChatService {
|
||||
if (!file) throw new Error("Attachment file was not found.");
|
||||
if (file.scan_state !== FILE_SCAN_STATE.APPROVED) throw new Error("Attachment file is not approved for handoff.");
|
||||
if (!this.senderCanReadFile(orgId, file, sender)) throw new Error("Attachment file access is required.");
|
||||
// A handoff carries the recorded checksum, so the bytes must still be the recorded ones.
|
||||
readVerifiedFile({ name: file.id, storagePath: file.storage_path, sha256: file.sha256 });
|
||||
return {
|
||||
fileId,
|
||||
checksum: file.sha256,
|
||||
|
||||
Reference in new issue
Block a user