Activity: whole-space rekeys (convergence, Finish rename, alias retirement) do not check grants left on the target folder name #983

Closed
opened 2026-10-20 07:20:35 +00:00 by Cordy · 2 comments
Owner

Found in the batch 4 final-fix review (finding 4, 2026-10-20).

What happens: whole-space rekeys at convergence, Finish rename and alias retirement (internal/api/spacerename.go:917) move the space's whole Activity history without asking the share check that file renames use since v0.6.351. This only matters when a person grant made before v0.6.215 is left on a folder name that another space later moves into. That grantee already reads the space's files, which is the bigger problem and predates this change; the Activity part is secondary.

To do:

  • Decide what happens to grants left on a space folder name: refuse convergence while one exists, or retire them.
  • Apply the same Activity rule as file renames.
  • Test on posix and s3.
Found in the batch 4 final-fix review (finding 4, 2026-10-20). **What happens:** whole-space rekeys at convergence, Finish rename and alias retirement (`internal/api/spacerename.go:917`) move the space's whole Activity history without asking the share check that file renames use since v0.6.351. This only matters when a person grant made before v0.6.215 is left on a folder name that another space later moves into. That grantee already reads the space's files, which is the bigger problem and predates this change; the Activity part is secondary. **To do:** - Decide what happens to grants left on a space folder name: refuse convergence while one exists, or retire them. - Apply the same Activity rule as file renames. - Test on posix and s3.
Author
Owner

Research and decision (2026-10-28): see the C2 decision sheet (.superpowers/sdd/2026-10-27-triage/c2-decisions.md).

Finding: share grants on space content made before v0.6.215 were never migrated and are still served (cmd/cairnd/main.go:2537; scope/shared.go:205-266 maps them to the stored folder path with no membership check).

  • A grantee can read, or with write also change, whatever sits at that path today, regardless of membership.
  • That includes another space's files once a new space takes the old folder name.
  • New grants on space content have been refused since v0.6.215 (internal/api/grants.go:258-268), so no new ones can appear.

Decision (Nikola): the only such grants in existence are on the two dogfoods, so they are simply deleted.

  • At start, Cairn removes every grant on a /spaces/... path, with one audit line per grant. No bell and no admin list.
  • /shared never serves a grant on a space path. This guard also covers state restored from an old backup.
  • Whole-space Activity moves get the same exposure check as other moves.
  • docs/handbook/spaces.md:587-595 is corrected.
**Research and decision (2026-10-28):** see the C2 decision sheet (`.superpowers/sdd/2026-10-27-triage/c2-decisions.md`). **Finding:** share grants on space content made before v0.6.215 were never migrated and are still served (`cmd/cairnd/main.go:2537`; `scope/shared.go:205-266` maps them to the stored folder path with no membership check). - A grantee can read, or with write also change, whatever sits at that path today, regardless of membership. - That includes another space's files once a new space takes the old folder name. - New grants on space content have been refused since v0.6.215 (`internal/api/grants.go:258-268`), so no new ones can appear. **Decision (Nikola):** the only such grants in existence are on the two dogfoods, so they are simply deleted. - At start, Cairn removes every grant on a `/spaces/...` path, with one audit line per grant. No bell and no admin list. - `/shared` never serves a grant on a space path. This guard also covers state restored from an old backup. - Whole-space Activity moves get the same exposure check as other moves. - `docs/handbook/spaces.md:587-595` is corrected.
Author
Owner

Shipped in v0.6.366 (PR #1032), both dogfoods bumped.

  • At start, every share grant on a /spaces/... path is removed; one audit line share-grant-retired per grant (user system, note grantee/grantor/role). No bell, no admin list, as decided. Removed grants are gone for good (a rollback doesn't bring them back).
  • /shared, "Shared with me" (/api/v1/shared) and the change feed never serve or list a grant on space content, also after an old backup is restored.
  • Grantees' locks under the removed grants are released at the same start.
  • Whole-space Activity moves: exposure check added; on a share-store read error the history moves (no space grant can exist any more).
  • Docs: spaces.md legacy-grant paragraph corrected.

Live check moved to #1005: count share-grant-retired in the audit log on both dogfoods after the first start.

Shipped in v0.6.366 (PR #1032), both dogfoods bumped. - At start, every share grant on a `/spaces/...` path is removed; one audit line `share-grant-retired` per grant (user system, note grantee/grantor/role). No bell, no admin list, as decided. Removed grants are gone for good (a rollback doesn't bring them back). - `/shared`, "Shared with me" (`/api/v1/shared`) and the change feed never serve or list a grant on space content, also after an old backup is restored. - Grantees' locks under the removed grants are released at the same start. - Whole-space Activity moves: exposure check added; on a share-store read error the history moves (no space grant can exist any more). - Docs: spaces.md legacy-grant paragraph corrected. Live check moved to #1005: count `share-grant-retired` in the audit log on both dogfoods after the first start.
Cordy closed this issue 2026-10-28 01:59:55 +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#983
No description provided.