feat(api): M8 7.15 slice 3 — downgrade discipline: auto-revoke + notify (CLS-07) #205

Merged
amiryahaya merged 1 commit from feat/m8-715-classification-core-3 into main 2026-11-16 09:14:28 +01:00
Owner

Completes CLS-07 and the 7.15 enforcement trio (#158).

What

A level LOWER now auto-revokes every active share of the resource whose holder's current clearance is below the new level:

  • RevokeViolatingSharesAsync (ClassificationGates): joins active shares to tenant memberships, resolves holder ranks via the ladder (null clearance = Internal, per CLS-02), revokes + audits each (share_auto_revoked_classification) + notifies each holder (in-app + push)
  • Wired into both re-classify handlers on the lower branch; response bodies expose revoked_grants for the F-CLS5 consequences dialog
  • File lower revokes the file's grants; folder lower revokes FOLDER grants only — contained files keep their own levels and grants (§12 CLS-E4 container-constraint, test-pinned)
  • Compliant holders are untouched and regain working access (Secret→Confidential lets Confidential holders back in — the lattice's revoke-on-lower also cleans up stale grants left by holder downgrades)
  • Raises never revoke — CLS-06's access-time gating already handles them (test-pinned)

Semantics worth noting

The revoke-on-lower doubles as stale-grant hygiene: a grant stranded by a holder's clearance drop (denied at access since, row intact) is finally revoked when the document is lowered to a rank they still violate — while holders the new level admits regain functionality immediately.

Verification

3 new tests (stale-grant revocation + notification + audit with compliant holder untouched; folder-lower revokes folder grants but never file grants; raise-never-revokes). Full suite 1073/0/40 locally.

7.15 enforcement is now complete: CLS-04 (slice 1), CLS-05/06 (slice 2), CLS-07 (this PR). Remaining in M8: 7.16 client UX.

Completes CLS-07 and the 7.15 enforcement trio (#158). ## What A level **LOWER** now auto-revokes every active share of the resource whose holder's current clearance is below the new level: - `RevokeViolatingSharesAsync` (ClassificationGates): joins active shares to tenant memberships, resolves holder ranks via the ladder (null clearance = Internal, per CLS-02), revokes + audits each (`share_auto_revoked_classification`) + notifies each holder (in-app + push) - Wired into both re-classify handlers on the lower branch; response bodies expose `revoked_grants` for the F-CLS5 consequences dialog - **File lower** revokes the file's grants; **folder lower** revokes FOLDER grants only — contained files keep their own levels and grants (§12 CLS-E4 container-constraint, test-pinned) - Compliant holders are untouched and **regain working access** (Secret→Confidential lets Confidential holders back in — the lattice's revoke-on-lower also cleans up stale grants left by holder downgrades) - **Raises never revoke** — CLS-06's access-time gating already handles them (test-pinned) ## Semantics worth noting The revoke-on-lower doubles as stale-grant hygiene: a grant stranded by a holder's clearance drop (denied at access since, row intact) is finally revoked when the document is lowered to a rank they still violate — while holders the new level admits regain functionality immediately. ## Verification 3 new tests (stale-grant revocation + notification + audit with compliant holder untouched; folder-lower revokes folder grants but never file grants; raise-never-revokes). Full suite **1073/0/40** locally. 7.15 enforcement is now complete: CLS-04 (slice 1), CLS-05/06 (slice 2), CLS-07 (this PR). Remaining in M8: 7.16 client UX.
feat(api): M8 7.15 slice 3 — downgrade discipline: auto-revoke + notify (CLS-07)
All checks were successful
API CI / migrations (pull_request) Successful in 2m22s
API CI / build-and-test (pull_request) Successful in 4m55s
Security CI / security-scan (pull_request) Successful in 4m44s
ecc7d0150c
Completes CLS-07: a level LOWER now auto-revokes every active share of
the resource whose holder's current clearance is below the new level —
each revocation audited (share_auto_revoked_classification) and the
holder notified (in-app + push). Compliant holders are untouched and
REGAIN working access (e.g. Secret→Confidential lets Confidential
holders back in); raises never revoke (CLS-06 access-time gating
handles them).

RevokeViolatingSharesAsync (ClassificationGates): joins active shares
to tenant memberships, resolves holder ranks via the ladder (null
clearance = Internal per CLS-02), revokes + audits + notifies. Wired
into both reclassify handlers on the lower branch:
- File lower → revokes the file's grants
- Folder lower → revokes FOLDER grants only; contained files keep their
  own levels and grants (§12 CLS-E4 container-constraint, pinned by test)

Response bodies expose revoked_grants for the F-CLS5 consequences dialog.

Tests: ShareLatticeTests +3 — stale-grant revocation + notification +
audit with compliant holder untouched; folder-lower revokes folder
grants but never file grants; raise-never-revokes. Suite 1073/0/40.
Sign in to join this conversation.
No description provided.