+13
−2
+306
−2
+17
−8
Loading
The upload hash shortcut previously required only resource creation access, allowing callers to reuse denied files and restore or rename deleted files. Restoration also happened before the attachment transaction, so a rejected attachment could leave the file restored despite returning HTTP 403. Require read access before reusing an existing file and update access before restoring it. Lock the existing file and keep authorization, restoration, and attachment in one transaction so failures roll back file changes and queued database tasks. Apply the same checks during completed-upload imports through an optional authorization callback in handle_uploaded_file. This covers files that appear after the initial hash lookup while preserving create-only access for new uploads and existing behavior for trusted internal callers. Add nine regression tests and update the existing attachment test to require read access. Cover denied reuse and restoration, permitted reuse without update access, successful restoration, attachment rollback, completed-upload reuse, and create-only uploads. Validation: Ruff passed for all changed Python files. All 216 resource, RPC, and annotation tests passed using an isolated in-memory SQLite database.