Deleted files: a grantee's deletion in a shared folder is recorded under the owner #915

Closed
opened 2026-10-15 17:36:00 +00:00 by Cordy · 4 comments
Owner

Found during the #911 research (scratch/b7e/batch907/911-research.md).

What happens: when someone with a write grant deletes a file inside a folder shared with them, the trash entry and its record name the owner as the person who deleted it.

Why it matters: the real deleter is lost, both for the owner (who removed my file?) and for audits.

To do: check the trash sidecar and the audit/activity records, and decide where the actor should be stored. Research first, as usual.

Found during the #911 research (`scratch/b7e/batch907/911-research.md`). **What happens:** when someone with a write grant deletes a file inside a folder shared with them, the trash entry and its record name the owner as the person who deleted it. **Why it matters:** the real deleter is lost, both for the owner (who removed my file?) and for audits. **To do:** check the trash sidecar and the audit/activity records, and decide where the actor should be stored. Research first, as usual.
Author
Owner

Deep research (2026-10-19)

The full write-up is in ~/cairn-work/scratch/b7e/backlog/research-b4.md §1, with sources.

Confirmed on posix and s3

bob, who holds a write grant on anna's /home/anna/proj, deletes a.txt. The trash entry says by=anna, the audit line says user=anna, and no record anywhere names bob.

Cause: scope/shared.go:238-249 (asOwner) replaces the whole user with the owner before calling the layers below, so audit, trash and file locks only ever see the owner.

Same cause, a second bug: a grantee can write through the owner's file lock (filed separately).

How others handle it

  • Nextcloud: puts the item in the owner's trash, plus a best-effort copy in the deleter's trash. Its trash view has a Deleted by column, added after years of "who deleted my shared files?" forum posts.
  • ownCloud 10: puts the item in both trash bins.
  • OpenCloud: its audit records User (the actor) and Owner separately.
  • Seafile: stores the deleter for each trash item.
  • Dropbox: admins can filter deleted files by who deleted them.
  • Google Drive: someone who doesn't own a file cannot delete it.

Standards

These all ask the log to name the person who acted:

  • Swiss DSV Art. 4: "Identität der Person, welche die Bearbeitung vorgenommen hat", and deleting and destroying are listed explicitly.
  • NIST SP 800-53 AU-3.
  • ISO 27001 A.8.15.
  • OWASP Logging Cheat Sheet. It names "the wrong identity is logged" as an accountability attack.

Recommendation

  1. Keep the owner identity for keys, paths and quota.
  2. Carry the real acting person alongside it, and use that person for the trash by, the audit user (plus a new owner field) and lock checks.
  3. Only the owner and admins see, restore and purge the entry, as today, but the row now shows who deleted it.
  4. A row for the deleter ("deleted by you, in anna's folder", restorable but never purgeable) is a later follow-up with its own mockup.
  5. No copy is made in the deleter's trash: such a copy outlives the share.

Decisions: asked now.

## Deep research (2026-10-19) The full write-up is in `~/cairn-work/scratch/b7e/backlog/research-b4.md` §1, with sources. ### Confirmed on posix and s3 bob, who holds a write grant on anna's `/home/anna/proj`, deletes `a.txt`. The trash entry says `by=anna`, the audit line says `user=anna`, and no record anywhere names bob. Cause: `scope/shared.go:238-249` (`asOwner`) replaces the whole user with the owner before calling the layers below, so audit, trash and file locks only ever see the owner. **Same cause, a second bug:** a grantee can write through the owner's file lock (filed separately). ### How others handle it - **Nextcloud:** puts the item in the owner's trash, plus a best-effort copy in the deleter's trash. Its trash view has a **Deleted by** column, added after years of "who deleted my shared files?" forum posts. - **ownCloud 10:** puts the item in both trash bins. - **OpenCloud:** its audit records `User` (the actor) and `Owner` separately. - **Seafile:** stores the deleter for each trash item. - **Dropbox:** admins can filter deleted files by who deleted them. - **Google Drive:** someone who doesn't own a file cannot delete it. ### Standards These all ask the log to name the person who acted: - Swiss DSV Art. 4: "Identität der Person, welche die Bearbeitung vorgenommen hat", and deleting and destroying are listed explicitly. - NIST SP 800-53 AU-3. - ISO 27001 A.8.15. - OWASP Logging Cheat Sheet. It names "the wrong identity is logged" as an accountability attack. ### Recommendation 1. Keep the owner identity for keys, paths and quota. 2. Carry the real acting person alongside it, and use that person for the trash `by`, the audit `user` (plus a new `owner` field) and lock checks. 3. Only the owner and admins see, restore and purge the entry, as today, but the row now shows who deleted it. 4. A row for the deleter ("deleted by you, in anna's folder", restorable but never purgeable) is a later follow-up with its own mockup. 5. No copy is made in the deleter's trash: such a copy outlives the share. **Decisions:** asked now.
Author
Owner

Decision (Nikola, 2026-10-19). All recommendations accepted.

  • D1 (b): carry the real person.
    • Keys, paths and quota stay with the owner.
    • The trash by, the audit user (plus a new owner field) and lock checks use the person who acted. This also fixes #972.
  • D2 (a): only the owner and admins see, restore and purge the entry. No copy goes into the deleter's trash. A restorable "deleted by you" row for the deleter is a later follow-up with a mockup.
  • D3 (a): the existing share-grant-* audit lines keep being written.
  • UI: no mockup needed. The owner's personal row deleted by someone else gets the existing chip style that space rows already use, {folder} · {name}, with "Deleted by {name}" on hover. I'll screenshot it live for Nikola's OK before closing.

Implemented in batch 4 (v0.6.351).

**Decision (Nikola, 2026-10-19).** All recommendations accepted. - **D1 (b): carry the real person.** - Keys, paths and quota stay with the owner. - The trash `by`, the audit `user` (plus a new `owner` field) and lock checks use the person who acted. This also fixes #972. - **D2 (a): only the owner and admins see, restore and purge the entry.** No copy goes into the deleter's trash. A restorable "deleted by you" row for the deleter is a later follow-up with a mockup. - **D3 (a): the existing `share-grant-*` audit lines keep being written.** - **UI:** no mockup needed. The owner's personal row deleted by someone else gets the existing chip style that space rows already use, `{folder} · {name}`, with "Deleted by {name}" on hover. I'll screenshot it live for Nikola's OK before closing. Implemented in batch 4 (v0.6.351).
Author
Owner

Shipped in v0.6.351 (PR #984). Both dogfoods run it. Still open: the live check needs a second account.

What changed:

  • Keys: the acting person is carried through the shared-folder identity swap. Keys, paths and quota stay with the owner.
  • Records naming the person who acted: the trash by, the audit user (with a new owner field), lock checks (#972), leak tracing and device-paused records.
  • UI: the owner's Deleted files row shows the chip "{folder} · {name}", with "Deleted by {name}" on hover.

Tests: on posix and s3, with encryption on and off.

Live check not done yet. It needs a second person, signed in, who holds a write grant on a folder of yours. I can't create accounts or sign in as anyone. To check it:

  1. As Nikola, share a folder with write access to a second test account.
  2. As that account, delete a file in it.
  3. Open your Deleted files. I take the screenshot of the chip for your OK and check the audit line, then close this issue.
**Shipped in v0.6.351 (PR #984). Both dogfoods run it. Still open: the live check needs a second account.** What changed: - **Keys:** the acting person is carried through the shared-folder identity swap. Keys, paths and quota stay with the owner. - **Records naming the person who acted:** the trash `by`, the audit `user` (with a new `owner` field), lock checks (#972), leak tracing and device-paused records. - **UI:** the owner's Deleted files row shows the chip "{folder} · {name}", with "Deleted by {name}" on hover. **Tests:** on posix and s3, with encryption on and off. **Live check not done yet.** It needs a second person, signed in, who holds a write grant on a folder of yours. I can't create accounts or sign in as anyone. To check it: 1. As Nikola, share a folder with write access to a second test account. 2. As that account, delete a file in it. 3. Open your Deleted files. I take the screenshot of the chip for your OK and check the audit line, then close this issue.
Author
Owner

Closing as fixed (v0.6.351): Deleted files and the audit record the acting person (internal/storage/trash/trash.go:296, internal/audit/driver.go:35, verified on v0.6.358 main). The two-account live check stays tracked in #1005 section F.

Closing as fixed (v0.6.351): Deleted files and the audit record the acting person (`internal/storage/trash/trash.go:296`, `internal/audit/driver.go:35`, verified on v0.6.358 main). The two-account live check stays tracked in #1005 section F.
Cordy closed this issue 2026-10-26 23:43:05 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#915
No description provided.