Repository navigation
Description
Defect
hard_delete_handler (pkgs/id/crates/id-web/src/routes/file_handlers.rs:1311) takes Json(req) immutable and passes req.name straight to FileOps::delete, skipping the canonical_web_name trim+validate step that delete_handler (:1216), restore_handler (:1266), save_handler (:49) and the other route at :252 all enforce:
// delete_handler — validates
Json(mut req): Json<DeleteRequest>,
...
if let Err(response) = canonical_web_name(&mut req.name) { return response; }
// hard_delete_handler — does not
Json(req): Json<DeleteRequest>,
...
match ops.delete(&req.name).await {The ops layer does not backstop it either: FileOps::delete (pkgs/id/crates/id-sync/src/fileops.rs:638) only rejects trim().is_empty(), never calls validate_name (:275) — while sibling entry point put (:388) and rename/copy via validate_target (:462, :581) do.
Impact
- A hard-delete request for
" notes/x ","a//b","a/../b", or a reserved archive name bypasses the canonical-name rule closed everywhere else by id(web): save/new file handlers bypass FileOps canonical name validation #10549/id(web): delete/restore file handlers bypass FileOps canonical name validation #10573/id(web): upload handler stores non-canonical multipart filenames verbatim when the extension matches #10585. Depending on tag-store semantics it either 404s inconsistently (soft-delete of the same padded name would have been trimmed+validated first) or, worse, deletes under a non-canonical key while soft-delete/restore disagree on what that key means. - This is the destructive endpoint: it removes the blob tag, all archive tags, and all metadata tags. It should be the most validated, not the least.
Acceptance criteria
-
hard_delete_handlerrunscanonical_web_name(&mut req.name)likedelete_handler/restore_handler(trim + reject with the same 4xx body). - Defense in depth:
FileOps::deletecallsSelf::validate_name(name)?instead of only the empty check, so direct ops callers get the same rule. - Test: padded (
" x "), empty-component ("a//b"), dot-dot, and reserved archive names are rejected by hard-delete; canonical names still hard-delete (metadata + archives removed).
Dedupe
No open issue or PR covers the hard-delete/canonical-name gap (searched hard delete, canonical; related design #4766 and decision #2091 are distinct; recent canonical-name fixes #10549/#10573/#10585 closed the other endpoints but missed this one).
Verified at origin/main c53f59052e. Worktree: ~/git/fleet/probe-creator-id-0045 (clean, read-only probe).
Activity
developing-today commentedon Nov 16, 2026
CODE-3855