PRIVACY: Activity history is shared between people with same-named files (keyed by the viewer's path) #971

Closed
opened 2026-10-19 21:02:14 +00:00 by Cordy · 4 comments
Owner

Found in the batch 4 research (research-b4.md §7.1) and independently in Task A (#916). Verified at the recording level.

What happens: actrec records Activity with the caller's view path (internal/storage/actrec/actrec.go:58-67), and the store keeps one global list keyed by that path (internal/activity/activity.go:84-105). Every person's home is /home/... in their own view, so bob's /home/b.txt and anna's /home/b.txt share one history. Each person's details pane lists the other's events (who, what, when). That also reveals that the other person has a file with that name. Rekey on a rename moves everyone's history for that path.

Related: renaming a space doesn't move its Activity history; older events stay under the old name (Task A).

Expected: Activity is keyed by the backend path (or a stable file id) and translated on read, as the change feed does. A person only ever sees events of the file they are looking at. Renames, including space renames, carry the history.

To do: fix and test on posix and s3, with two users who have same-named files, a shared folder, a space rename, and #916's restore records.

Found in the batch 4 research (`research-b4.md` §7.1) and independently in Task A (#916). Verified at the recording level. **What happens:** `actrec` records Activity with the caller's **view** path (`internal/storage/actrec/actrec.go:58-67`), and the store keeps one global list keyed by that path (`internal/activity/activity.go:84-105`). Every person's home is `/home/...` in their own view, so bob's `/home/b.txt` and anna's `/home/b.txt` share one history. Each person's details pane lists the other's events (who, what, when). That also reveals that the other person has a file with that name. `Rekey` on a rename moves everyone's history for that path. **Related:** renaming a space doesn't move its Activity history; older events stay under the old name (Task A). **Expected:** Activity is keyed by the backend path (or a stable file id) and translated on read, as the change feed does. A person only ever sees events of the file they are looking at. Renames, including space renames, carry the history. **To do:** fix and test on posix and s3, with two users who have same-named files, a shared folder, a space rename, and #916's restore records.
Author
Owner

Batch 4 review (2026-10-19): #916 now records restores (including admin restores) on the person's view path. Because Activity is keyed by that view path, this makes the leak wider. An admin restore of anna's /home/x.txt would show as "admin restored" in bob's Activity for his own, unrelated /home/x.txt.

So this issue is pulled into batch 4 and fixed before the release:

  • Activity is keyed by the backend path (or a stable file id) and translated on read, as the change feed does.
  • #916's restore records use the backend path again.
  • Space renames carry the history.
**Batch 4 review (2026-10-19):** #916 now records restores (including admin restores) on the person's view path. Because Activity is keyed by that view path, this makes the leak wider. An admin restore of anna's `/home/x.txt` would show as "admin restored" in bob's Activity for his own, unrelated `/home/x.txt`. So this issue is pulled into batch 4 and fixed before the release: - Activity is keyed by the backend path (or a stable file id) and translated on read, as the change feed does. - #916's restore records use the backend path again. - Space renames carry the history.
Author
Owner

Built in batch 4 (v0.6.351), with two privacy-safe defaults I chose. Nikola: please confirm or overrule.

  1. History across moves:
    • A file keeps its Activity history only when it moves within the same home or the same space. A grantee moving files inside a shared folder counts as staying in the owner's home.
    • Any other move (home to space, space to space) records only the move event at the new place, and the old history stays with the old path.
    • Without this, moving a file into a space would show its private edit history to every member.
  2. Share events (share-created / share-removed): shown only to administrators, the home or space owner, and the person who made the share. Before this change nobody saw them.

Upgrade side effect: spaces that existed before the space identity registry (#768) got their id at that registry's first start. Their Activity from before that start is hidden, at most a few days of events. This comes from the rule that hides events older than a space's id, which stops a reused space name from showing the old space's history.

**Built in batch 4 (v0.6.351), with two privacy-safe defaults I chose. Nikola: please confirm or overrule.** 1. **History across moves:** - A file keeps its Activity history only when it moves within the same home or the same space. A grantee moving files inside a shared folder counts as staying in the owner's home. - Any other move (home to space, space to space) records only the `move` event at the new place, and the old history stays with the old path. - Without this, moving a file into a space would show its private edit history to every member. 2. **Share events** (`share-created` / `share-removed`): shown only to administrators, the home or space owner, and the person who made the share. Before this change nobody saw them. **Upgrade side effect:** spaces that existed before the space identity registry (#768) got their id at that registry's first start. Their Activity from before that start is hidden, at most a few days of events. This comes from the rule that hides events older than a space's id, which stops a reused space name from showing the old space's history.
Author
Owner

Update after the final reviews (2026-10-20): the move rule as now built.

The first rule (history follows any move within one home or space) still leaked. Moving a file into a subfolder shared with someone else showed that person a third person's edits.

Final rule:

  • Rename in place: history is kept in full when the new name is in the same folder and no share sits at or below the new name.
  • Move into a shared name: a rename onto a name that has its own share, or into a share the old path wasn't in, carries only the owner's and the mover's events. This includes REST rename with overwrite, WebDAV MOVE with Overwrite: T, and renaming a shared name away and another name into it. In a space, only the mover's events follow.
  • Move to another folder: only the owner's and the mover's events follow (in a space, only the mover's).
  • Move to another home or space: no history follows.
  • Where events stay: everyone else's events stay with the old path, where the same people as before can see them.

The share check reads the persisted share data on each rename (#742). If that data cannot be read, the rename takes the safe side and logs a WARN.

Related, filed: #981 (a re-created account's history, and ownership transfers) and #982 (sibling folders that differ only in case). Both predate this change.

**Update after the final reviews (2026-10-20): the move rule as now built.** The first rule (history follows any move within one home or space) still leaked. Moving a file into a subfolder shared with someone else showed that person a third person's edits. **Final rule:** - **Rename in place:** history is kept in full when the new name is in the same folder and no share sits at or below the new name. - **Move into a shared name:** a rename onto a name that has its own share, or into a share the old path wasn't in, carries only the owner's and the mover's events. This includes REST rename with `overwrite`, WebDAV MOVE with `Overwrite: T`, and renaming a shared name away and another name into it. In a space, only the mover's events follow. - **Move to another folder:** only the owner's and the mover's events follow (in a space, only the mover's). - **Move to another home or space:** no history follows. - **Where events stay:** everyone else's events stay with the old path, where the same people as before can see them. The share check reads the persisted share data on each rename (#742). If that data cannot be read, the rename takes the safe side and logs a WARN. Related, filed: #981 (a re-created account's history, and ownership transfers) and #982 (sibling folders that differ only in case). Both predate this change.
Author
Owner

Shipped in v0.6.351 (PR #984). Both dogfoods run it.

Upgrade at the first start: existing Activity was converted once into activity-v2.json.

  • files: 48 entries kept.
  • files-bao: 99 kept; 7 dropped because they could not be attributed to one person's file (WARN activity: entries from before the upgrade that cannot be attributed … were dropped (#971)).

Live, 2026-10-20: my own file's Activity showed only my events, at my path (upload, restore).

Not seen live: the cross-person cases (two people with same-named files, grantees, moves between shared folders). They need a second account signed in at the same time. They are covered by tests on posix and s3, including every repro from the reviews.

The move rule as built is in the comment above. Follow-ups: #981, #982, #983.

**Shipped in v0.6.351 (PR #984). Both dogfoods run it.** **Upgrade at the first start:** existing Activity was converted once into `activity-v2.json`. - files: 48 entries kept. - files-bao: 99 kept; 7 dropped because they could not be attributed to one person's file (WARN `activity: entries from before the upgrade that cannot be attributed … were dropped (#971)`). **Live, 2026-10-20:** my own file's Activity showed only my events, at my path (`upload`, `restore`). **Not seen live:** the cross-person cases (two people with same-named files, grantees, moves between shared folders). They need a second account signed in at the same time. They are covered by tests on posix and s3, including every repro from the reviews. The move rule as built is in the comment above. Follow-ups: #981, #982, #983.
Cordy closed this issue 2026-10-20 13:58:12 +00:00
Sign in to join this conversation.
No labels
No milestone
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#971
No description provided.