From fa0c4368d774eed9f2c34da6f63dccb24c4038c1 Mon Sep 17 00:00:00 2001
From: Trenton H <797416+stumpylog@users.noreply.github.com>
Date: Fri, 5 Jun 2026 06:46:45 -0700
Subject: [PATCH 01/29] Fix: Ensure checksum comparison is using SHA256 in file
handling (#12939)
---
src/documents/signals/handlers.py | 5 ++---
src/documents/tests/test_file_handling.py | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py
index a34a3acf9..f85763d5f 100644
--- a/src/documents/signals/handlers.py
+++ b/src/documents/signals/handlers.py
@@ -1,7 +1,6 @@
from __future__ import annotations
import datetime
-import hashlib
import logging
import shutil
import traceback as _tb
@@ -54,6 +53,7 @@ from documents.models import WorkflowTrigger
from documents.permissions import get_objects_for_user_owner_aware
from documents.plugins.helpers import DocumentsStatusManager
from documents.templating.utils import convert_format_str_to_template_format
+from documents.utils import compute_checksum
from documents.workflows.actions import build_workflow_action_context
from documents.workflows.actions import execute_email_action
from documents.workflows.actions import execute_move_to_trash_action
@@ -410,8 +410,7 @@ def _path_matches_checksum(path: Path, checksum: str | None) -> bool:
if checksum is None or not path.is_file():
return False
- with path.open("rb") as f:
- return hashlib.md5(f.read()).hexdigest() == checksum
+ return compute_checksum(path) == checksum
def _filename_template_uses_custom_fields(doc: Document) -> bool:
diff --git a/src/documents/tests/test_file_handling.py b/src/documents/tests/test_file_handling.py
index dc0fbb74c..2ae04b063 100644
--- a/src/documents/tests/test_file_handling.py
+++ b/src/documents/tests/test_file_handling.py
@@ -221,8 +221,8 @@ class TestFileHandling(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
doc = Document.objects.create(
title="document",
mime_type="application/pdf",
- checksum=hashlib.md5(original_bytes).hexdigest(),
- archive_checksum=hashlib.md5(archive_bytes).hexdigest(),
+ checksum=hashlib.sha256(original_bytes).hexdigest(),
+ archive_checksum=hashlib.sha256(archive_bytes).hexdigest(),
filename="old/document.pdf",
archive_filename="old/document.pdf",
storage_path=old_storage_path,
From 449fd97b1f052c333470a7ae47896d702d59e04b Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Fri, 5 Jun 2026 07:16:53 -0700
Subject: [PATCH 02/29] Fix (beta): respect disable state for suggest endpoint,
require change perms (#12942)
---
.../suggestions-dropdown.component.html | 4 ++--
.../suggestions-dropdown.component.spec.ts | 12 ++++++++++++
.../suggestions-dropdown.component.ts | 8 ++++++++
src/documents/views.py | 4 ++--
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src-ui/src/app/components/common/suggestions-dropdown/suggestions-dropdown.component.html b/src-ui/src/app/components/common/suggestions-dropdown/suggestions-dropdown.component.html
index 7e1a29666..8fb900eaa 100644
--- a/src-ui/src/app/components/common/suggestions-dropdown/suggestions-dropdown.component.html
+++ b/src-ui/src/app/components/common/suggestions-dropdown/suggestions-dropdown.component.html
@@ -1,5 +1,5 @@
-