Security: spaces API discloses spaces to non-members; space takeover via create and rename (#923, #927; v0.6.346) #937

Merged
Cordy merged 13 commits from fix-923 into main 2026-10-16 00:51:49 +00:00
Owner

Fixes #923 and #927, and closes the rename path of #931.

Spec: docs/superpowers/specs/2026-10-16-fix-923-design.md. Plan: docs/superpowers/plans/2026-10-16-fix-923.md. Every task went through TDD and a task review. Then a whole-branch review, a docs accuracy review, and fix rounds for each.

Security

  • One gate on all 19 /api/v1/spaces/{name} routes: a session admin, or a member under the membership rule. Everyone else, including Basic admins, gets a byte-identical 404, the same as for a missing space. NFC and NFD forms of a name get the same answer.
  • The spaces list: shows a person only their own spaces, with their role. It makes no identity-provider call for them. Session admins keep the unchanged inventory (golden from main, byte-identical).
  • Former names: visible only to the owner and admins (/meta answers the asked name to everyone else).
  • Create and rename never adopt an existing folder: this covers directory spaces, orphans, other spaces' folders and former names, case and Unicode included. People get one generic 409; session admins get the specific reason. Take-over is an explicit, audited session-admin action, only over an orphan folder. Without a group listing, it works over any folder that no space claims.
  • Deleted names: a new space over an expired name starts with a fresh identity and inherits nothing.

Tests

  • Rig tests on posix and s3.
  • A gate matrix that checks main's golden for passing callers and byte-identical 404s for refused ones.
  • Probes for the takeover by create, by rename (S3) and through Unicode.
  • Production wiring tests.

Filed along the way

#928, #929, #930, #931 (convergence sweep), #932, #933, #934, #935, #936.

Upgrade notes

See CHANGELOG v0.6.346.

Fixes #923 and #927, and closes the rename path of #931. Spec: `docs/superpowers/specs/2026-10-16-fix-923-design.md`. Plan: `docs/superpowers/plans/2026-10-16-fix-923.md`. Every task went through TDD and a task review. Then a whole-branch review, a docs accuracy review, and fix rounds for each. ## Security - **One gate on all 19 `/api/v1/spaces/{name}` routes:** a session admin, or a member under the membership rule. Everyone else, including Basic admins, gets a byte-identical 404, the same as for a missing space. NFC and NFD forms of a name get the same answer. - **The spaces list:** shows a person only their own spaces, with their role. It makes no identity-provider call for them. Session admins keep the unchanged inventory (golden from main, byte-identical). - **Former names:** visible only to the owner and admins (`/meta` answers the asked name to everyone else). - **Create and rename never adopt an existing folder:** this covers directory spaces, orphans, other spaces' folders and former names, case and Unicode included. People get one generic 409; session admins get the specific reason. Take-over is an explicit, audited session-admin action, only over an orphan folder. Without a group listing, it works over any folder that no space claims. - **Deleted names:** a new space over an expired name starts with a fresh identity and inherits nothing. ## Tests - Rig tests on posix and s3. - A gate matrix that checks main's golden for passing callers and byte-identical 404s for refused ones. - Probes for the takeover by create, by rename (S3) and through Unicode. - Production wiring tests. ## Filed along the way #928, #929, #930, #931 (convergence sweep), #932, #933, #934, #935, #936. ## Upgrade notes See CHANGELOG v0.6.346.
One gate (SpacesAPI.gated) wraps all 19 {name} routes and runs before any
syntax check, body parse or lookup: a session admin passes, a member by
name or former name (scope.Membership.SpaceNamed) passes, in power mode
the recorded owner passes (IdP errors fail closed); everyone else gets
spaceNotFound (404, X-Cairn-Code not-found) and one 'spaces: refused'
log line. Every existing 'no such space' 404 in the spaces handlers uses
the same helper (R2). SpacesAPI.Membership nil fails closed (R11);
main.go sets it once after both SpacesAPI branches.

Tests: route table, gate matrix (golden re-recorded: refused cells and
R2 404 bodies only), nil membership, power-mode owner, refusal log,
no membership copies, main wiring and production membership. Fixtures
take testMembership (production chain, R12); three leak tests rewritten;
non-member 403s become 404 with a member 403 row kept.
Cordy merged commit 8a20c21875 into main 2026-10-16 00:51:49 +00:00
Sign in to join this conversation.
No reviewers
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#937
No description provided.