fix(api-sharing): M8 audit batch 4 — cross-tenant recipients, member-removal purge, owner revoke, unique active-share index (#214) #219
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!219
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/m8-api-sharing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
M8-close audit remediation batch 4 (#214 findings M8-5, M8-15, M8-16, M8-19).
M8-5 (tenant-boundary leak): CreateShare required the recipient to exist but not to share the caller's tenant — a cross-tenant user id was accepted (their lattice rank read as 0 here) and the grant notification delivered the real resource name across tenant boundaries. Now 404 (no existence signal).
M8-15 (removal was reversible): RemoveMember purges the removed user's group memberships — stale rows made them silent group-share recipients (clients encrypted keys for non-members) — and revokes their active grants on the tenant's resources; previously removal was silently reversible on re-invite. The Share-revocation half carries a documented UpwardSeams entry (Org→Sharing) pending task 7.3's grant-revocation public interface; the architecture suite stays green.
M8-16 (unkillable grants): the resource OWNER or a tenant admin can now revoke any active share — previously only the original sharer, so re-shares and departed-sharer grants were permanently unkillable.
M8-19 (revocation not a guarantee): ix_shares_active is now UNIQUE (filtered index + migration) — a double-click produced duplicate active grants and revoking one left its twin alive. Concurrent-create races map to 409 at both create endpoints via DbErrors.IsUniqueConstraintViolation.
Tests: M8SharingFixTests (4) — cross-tenant 404 + same-tenant accepted, owner revokes a member re-share and B's download really dies, duplicate active grant 409, RemoveMember drops memberships + revokes grants. Full suite 1086 green (incl. architecture suite with the new seam).
Part of the M8-close FIX-ALL (umbrella #215, audit #214).
a8a67ab76965e38ff47d