M8 epic — Groups & Classification Lattice (CLS-01..09, tasks 7.14–7.16) #158

Closed
opened 2026-11-11 16:20:48 +01:00 by amiryahaya · 5 comments
Owner

Adopted requirements (product decision 2026-11-11, SRS §3.18 CLS-01..09, PRs #156 + UX flows #157 — ux-flows v2.0 F-CLS1–6). Org-level opt-in (classification_enabled, default off = zero behavioral delta): Internal < Confidential < Secret < Top Secret as a per-tenant ordered level table; personal clearance (admin-assigned, constant); groups with floor levels (membership requires clearance ≥ floor); lattice filter over existing ACLs (no read-up on shares, no write down on uploads); downgrade = owner-or-admin + auto-revoke + notify + audit.

Tasks (dev plan v1.9, Phase 7 additions ~2.5 wk):

  • 7.14 User groups: entity + membership (floor rule, auto-removal on downgrade), admin management UI, share-target integration — CLS-03
  • 7.15 Classification core: tenant flag + migration/backfill, per-tenant ordered level table (enforcement compares order, never hardcoded enums), level fields on users/folders/files, upload gating, share-lattice filter + classification_insufficient denials, read-time re-check, downgrade discipline — CLS-01, CLS-02, CLS-04–07, CLS-09
  • 7.16 Client UX: level badges (text label + color), clearance in profiles/members, share-dialog recipient filtering with reasons, classification pickers — CLS-08

Acceptance (exit): flag on → TS→Confidential share impossible (denied + audited), C→TS works, clearance downgrade revokes violating grants and drops below-floor memberships; flag off → zero behavioral delta; all five audit events queryable.

Order: 7.14 (groups entity) must land before 7.15/7.16. Slots after the Phase 7 core; independent of DUR (M9).

SRS: §3.18 · UX: F-CLS1–6 (ux-flows v2.0) · Spec PRs: #156, #157

**Adopted requirements** (product decision 2026-11-11, SRS §3.18 CLS-01..09, PRs [#156](https://forgejo.primatekun.tech/primatekuntech/failsulit/pulls/156) + UX flows [#157](https://forgejo.primatekun.tech/primatekuntech/failsulit/pulls/157) — ux-flows v2.0 F-CLS1–6). Org-level opt-in (`classification_enabled`, default off = zero behavioral delta): **Internal < Confidential < Secret < Top Secret** as a per-tenant ordered level table; personal clearance (admin-assigned, constant); groups with floor levels (membership requires clearance ≥ floor); lattice filter over existing ACLs (no read-up on shares, no write down on uploads); downgrade = owner-or-admin + auto-revoke + notify + audit. **Tasks** (dev plan v1.9, Phase 7 additions ~2.5 wk): - 7.14 User groups: entity + membership (floor rule, auto-removal on downgrade), admin management UI, share-target integration — CLS-03 - 7.15 Classification core: tenant flag + migration/backfill, per-tenant ordered level table (enforcement compares order, never hardcoded enums), level fields on users/folders/files, upload gating, share-lattice filter + `classification_insufficient` denials, read-time re-check, downgrade discipline — CLS-01, CLS-02, CLS-04–07, CLS-09 - 7.16 Client UX: level badges (text label + color), clearance in profiles/members, share-dialog recipient filtering with reasons, classification pickers — CLS-08 **Acceptance (exit)**: flag on → TS→Confidential share impossible (denied + audited), C→TS works, clearance downgrade revokes violating grants and drops below-floor memberships; flag off → zero behavioral delta; all five audit events queryable. **Order**: 7.14 (groups entity) must land before 7.15/7.16. Slots after the Phase 7 core; independent of DUR (M9). **SRS**: §3.18 · **UX**: F-CLS1–6 (ux-flows v2.0) · **Spec PRs**: #156, #157
Author
Owner

M8 SEC-12 gate — STRIDE pre-pass complete (PR #199, threat-model §12)

Six findings, four need a binding decision from you (silence = adopted, per the §11 convention):

  1. CLS-T1 (High) — level-table remap inverts all enforcement (reorder rows → mass read-up, no code change). Proposed binding: table platform-provisioned at flag-enable, NO tenant edit surface this iteration; future custom-labels = order-preserving renames only.
  2. CLS-E2 (High) — clearance changes had no audit event + self-raise undefined. Proposed binding: clearance_assigned/changed audit events + no-self-change (setter ≠ target; Owner sets Admin/Member, Admin sets Member).
  3. CLS-E3 (Medium) — floor-RAISE above members' clearance was unspecified. Proposed binding: symmetric auto-remove (same group_membership_auto_removed event + notifications).
  4. CLS-E4 (Medium) — folder-level change cascade unspecified (lowered folder badge over TS files = badge lies). Proposed binding: container-constraint semantics — files keep their levels, enforcement per-file, folder badge = container floor for NEW content; raises don't retroactively revoke (CLS-06 read-time re-check governs existing grants).

Plus two accepted/low: CLS-T5 (downloads re-check per chunk; presign TTL constraint if ever introduced), CLS-D6 (mass-downgrade notification storms → SEC-08 caps).

Core soundness argument now in §12.2: floors gate distribution, personal clearance gates access — every control above leans on CLS-06 being per-principal and un-cacheable; its acceptance tests are the load-bearing wall.

SRS §3.18 rows amended in place (marked [§12 …]). Once you confirm/veto the four, 7.14 (groups entity) starts under the amended spec.

## M8 SEC-12 gate — STRIDE pre-pass complete (PR #199, threat-model §12) Six findings, **four need a binding decision from you** (silence = adopted, per the §11 convention): 1. **CLS-T1 (High)** — level-table remap inverts all enforcement (reorder rows → mass read-up, no code change). **Proposed binding:** table platform-provisioned at flag-enable, NO tenant edit surface this iteration; future custom-labels = order-preserving renames only. 2. **CLS-E2 (High)** — clearance changes had no audit event + self-raise undefined. **Proposed binding:** `clearance_assigned/changed` audit events + no-self-change (setter ≠ target; Owner sets Admin/Member, Admin sets Member). 3. **CLS-E3 (Medium)** — floor-RAISE above members' clearance was unspecified. **Proposed binding:** symmetric auto-remove (same `group_membership_auto_removed` event + notifications). 4. **CLS-E4 (Medium)** — folder-level change cascade unspecified (lowered folder badge over TS files = badge lies). **Proposed binding:** container-constraint semantics — files keep their levels, enforcement per-file, folder badge = container floor for NEW content; raises don't retroactively revoke (CLS-06 read-time re-check governs existing grants). Plus two accepted/low: CLS-T5 (downloads re-check per chunk; presign TTL constraint if ever introduced), CLS-D6 (mass-downgrade notification storms → SEC-08 caps). Core soundness argument now in §12.2: **floors gate distribution, personal clearance gates access** — every control above leans on CLS-06 being per-principal and un-cacheable; its acceptance tests are the load-bearing wall. SRS §3.18 rows amended in place (marked `[§12 …]`). Once you confirm/veto the four, 7.14 (groups entity) starts under the amended spec.
Author
Owner

7.14 landed — PR #200 merged (361c553): server + admin-portal slices

Server (CLS-02/03 + the four adopted §12 decisions):

  • Platform-provisioned per-tenant ladder (classification_levels, name+rank unique) + tenants.ClassificationEnabled — one-way enable, backfill to Internal, no disable endpoint (CLS-T1)
  • Personal clearance on user_tenants with no-self-change + clearance_assigned/changed audit (CLS-E2)
  • Groups + membership with floor rule at add-time; floor-raise auto-removal symmetric to downgrade (CLS-E3), floor lowering refused
  • Both auto-removal directions audited (group_membership_auto_removed) + in-app notified
  • Admin routes in the AuthzMatrix (Coverage test keeps direction)

Admin portal (F-CLS4): ClassificationPanel (enable + ladder chips + groups table + members dialog with eligible/ineligible-with-reason), clearance dropdown per member row.

Scope call (deliberate): share-to-group targeting moved to 7.15 — it is intrinsically tied to the lattice filter + per-principal access-time resolution (encrypted-key distribution mechanics) and has zero flag-off behavior; landing Share schema changes without consumers adds risk for no behavior.

New permanent guard (from #196, in this PR): MigrationSmokeTests + api-ci migrations job — the full migration chain now applies to fresh postgres:17 on every PR touching the API. The #195 outage bug class (hand-written SQL with wrong casing, ~21h staging crash-loop) fails CI at PR time from now on. Schema-convention pins (snake_case tables / PascalCase columns) included.

Verification: server suite 1050/0/39-skip locally (11 new tests), admin 244/244, tsc clean; PR runs green (security + api incl. migrations job); flag-off tenants 409 on every classification endpoint — zero behavioral delta, safe to deploy.

Next: 7.15 classification core (upload gating, share lattice filter, read-time re-check, downgrade discipline + share-to-group targeting).

## 7.14 landed — PR #200 merged (361c553): server + admin-portal slices **Server** (CLS-02/03 + the four adopted §12 decisions): - Platform-provisioned per-tenant ladder (`classification_levels`, name+rank unique) + `tenants.ClassificationEnabled` — one-way enable, backfill to Internal, no disable endpoint (CLS-T1) - Personal clearance on `user_tenants` with **no-self-change** + `clearance_assigned/changed` audit (CLS-E2) - Groups + membership with floor rule at add-time; **floor-raise auto-removal** symmetric to downgrade (CLS-E3), floor lowering refused - Both auto-removal directions audited (`group_membership_auto_removed`) + in-app notified - Admin routes in the AuthzMatrix (Coverage test keeps direction) **Admin portal** (F-CLS4): ClassificationPanel (enable + ladder chips + groups table + members dialog with eligible/ineligible-with-reason), clearance dropdown per member row. **Scope call (deliberate):** share-to-group targeting moved to **7.15** — it is intrinsically tied to the lattice filter + per-principal access-time resolution (encrypted-key distribution mechanics) and has zero flag-off behavior; landing Share schema changes without consumers adds risk for no behavior. **New permanent guard (from #196, in this PR):** `MigrationSmokeTests` + api-ci `migrations` job — the full migration chain now applies to fresh postgres:17 on every PR touching the API. The #195 outage bug class (hand-written SQL with wrong casing, ~21h staging crash-loop) fails CI at PR time from now on. Schema-convention pins (snake_case tables / PascalCase columns) included. **Verification:** server suite 1050/0/39-skip locally (11 new tests), admin 244/244, tsc clean; PR runs green (security + api incl. migrations job); flag-off tenants 409 on every classification endpoint — zero behavioral delta, safe to deploy. Next: **7.15 classification core** (upload gating, share lattice filter, read-time re-check, downgrade discipline + share-to-group targeting).
Author
Owner

7.15 slice 2 landed — PR #204 merged (f0f0603): share lattice + read-time re-check + group shares

CLS-05 (grant-time): user shares gated by document level ≤ recipient clearance; group shares (new POST /api/shares/group) gated by document level ≤ group floor. Denials → 403 classification_insufficient + share_denied_classification audit.

Group shares — SNAPSHOT semantics (design decision, unobjected → adopted): zero-knowledge forces per-recipient key material, so a group share materializes one Share row per CURRENT member (server-resolved membership; the sharer's client supplies per-member encrypted keys). shares.ShareTargetGroupId attributes the rows. Members joining a group later do not retroactively hold keys for pre-existing shares — documented in the endpoint, tests, and here as the accepted trade-off of snapshot semantics; owner re-share covers new members, and CLS-06 still gates every row by its holder's clearance.

CLS-06 (read-time re-check) — the load-bearing wall, now enforced: every share-granted path re-checks per access — GetFolder, ListFiles, DownloadFile (per-request = per-chunk, §12 CLS-T5), GetFolderKey (decryption oracle), ListFolders (below-clearance items hidden). Flagship test: downgrade a member mid-session → all share-granted paths refuse on next access with grant rows untouched. Owners keep inherent access to their own content (documented residual — downgrades don't brick owners; re-classification is the remedy).

CLS-09: share_denied_classification + group_share_created events feed the audit chain.

Suite 1070/0/40; PR runs green by SHA (api-ci incl. migrations leg + security-ci). Ride-along: test fixture mirrors the CLS-02 joiner clearance default.

Remaining in 7.15: slice 3 — downgrade discipline (CLS-07 auto-revoke of violating grants + recipient notification on document level lowers).

## 7.15 slice 2 landed — PR #204 merged (f0f0603): share lattice + read-time re-check + group shares **CLS-05 (grant-time):** user shares gated by `document level ≤ recipient clearance`; group shares (new `POST /api/shares/group`) gated by `document level ≤ group floor`. Denials → 403 `classification_insufficient` + `share_denied_classification` audit. **Group shares — SNAPSHOT semantics (design decision, unobjected → adopted):** zero-knowledge forces per-recipient key material, so a group share materializes one Share row per CURRENT member (server-resolved membership; the sharer's client supplies per-member encrypted keys). `shares.ShareTargetGroupId` attributes the rows. **Members joining a group later do not retroactively hold keys for pre-existing shares** — documented in the endpoint, tests, and here as the accepted trade-off of snapshot semantics; owner re-share covers new members, and CLS-06 still gates every row by its holder's clearance. **CLS-06 (read-time re-check) — the load-bearing wall, now enforced:** every share-granted path re-checks per access — GetFolder, ListFiles, DownloadFile (per-request = per-chunk, §12 CLS-T5), GetFolderKey (decryption oracle), ListFolders (below-clearance items hidden). Flagship test: downgrade a member mid-session → all share-granted paths refuse on next access with grant rows untouched. Owners keep inherent access to their own content (documented residual — downgrades don't brick owners; re-classification is the remedy). **CLS-09:** `share_denied_classification` + `group_share_created` events feed the audit chain. Suite 1070/0/40; PR runs green by SHA (api-ci incl. migrations leg + security-ci). Ride-along: test fixture mirrors the CLS-02 joiner clearance default. Remaining in 7.15: **slice 3 — downgrade discipline** (CLS-07 auto-revoke of violating grants + recipient notification on document level lowers).
Author
Owner

7.15 slice 3 landed — PR #205 merged (4a1f987): downgrade discipline. CLS enforcement is COMPLETE.

CLS-07 completion: a level LOWER now auto-revokes every active share whose holder's current clearance sits below the new rank — each revocation audited (share_auto_revoked_classification) + holder notified (in-app + push). Compliant holders untouched and REGAIN working access (Secret→Confidential readmits Confidential holders); raises never revoke (CLS-06 access-time gating already governs them — test-pinned). Folder lowers revoke FOLDER grants only; contained files keep their own levels and grants (§12 CLS-E4 container-constraint, test-pinned). Response bodies expose revoked_grants for the F-CLS5 consequences dialog (7.16).

Notable semantics: revoke-on-lower doubles as stale-grant hygiene — grants stranded by a holder's clearance drop (denied at access since, row intact per CLS-06) are finally cleaned up when the document lowers to a rank they still violate.

7.15 scoreboard (slices 1–3, PRs #203/#204/#205, suite 1073/0/40)

  • CLS-04 ✅ container/file levels, upload gating, raise-only override
  • CLS-05 ✅ grant-time lattice (user clearance + group floor) + share_denied_classification audit + snapshot group shares
  • CLS-06 ✅ read-time re-check on every share-granted path (incl. per-chunk downloads); grant rows stay, access bites
  • CLS-07 ✅ lowering = owner/admin + always audited + auto-revoke + notify
  • CLS-09 ✅ all audit events live: classification_set/raised/lowered, share_denied_classification, group_membership_auto_removed, clearance_assigned/changed, group_share_created, share_auto_revoked_classification, group_created/updated/deleted, group_member_added/removed
  • CLS-02/03 ✅ (7.14) clearance + groups with both auto-removal directions

Remaining in M8: 7.16 client UX (desktop level badges, classification pickers at folder-create/upload, share-dialog eligibility rendering against the new endpoints) — the server contract is fully in place (DTOs carry levels, group-share batch endpoint ready for the client's per-member key encryption).

## 7.15 slice 3 landed — PR #205 merged (4a1f987): downgrade discipline. **CLS enforcement is COMPLETE.** **CLS-07 completion:** a level LOWER now auto-revokes every active share whose holder's current clearance sits below the new rank — each revocation audited (`share_auto_revoked_classification`) + holder notified (in-app + push). Compliant holders untouched and REGAIN working access (Secret→Confidential readmits Confidential holders); **raises never revoke** (CLS-06 access-time gating already governs them — test-pinned). Folder lowers revoke FOLDER grants only; contained files keep their own levels and grants (§12 CLS-E4 container-constraint, test-pinned). Response bodies expose `revoked_grants` for the F-CLS5 consequences dialog (7.16). Notable semantics: revoke-on-lower doubles as **stale-grant hygiene** — grants stranded by a holder's clearance drop (denied at access since, row intact per CLS-06) are finally cleaned up when the document lowers to a rank they still violate. ## 7.15 scoreboard (slices 1–3, PRs #203/#204/#205, suite 1073/0/40) - **CLS-04** ✅ container/file levels, upload gating, raise-only override - **CLS-05** ✅ grant-time lattice (user clearance + group floor) + `share_denied_classification` audit + snapshot group shares - **CLS-06** ✅ read-time re-check on every share-granted path (incl. per-chunk downloads); grant rows stay, access bites - **CLS-07** ✅ lowering = owner/admin + always audited + auto-revoke + notify - **CLS-09** ✅ all audit events live: classification_set/raised/lowered, share_denied_classification, group_membership_auto_removed, clearance_assigned/changed, group_share_created, share_auto_revoked_classification, group_created/updated/deleted, group_member_added/removed - **CLS-02/03** ✅ (7.14) clearance + groups with both auto-removal directions Remaining in M8: **7.16 client UX** (desktop level badges, classification pickers at folder-create/upload, share-dialog eligibility rendering against the new endpoints) — the server contract is fully in place (DTOs carry levels, group-share batch endpoint ready for the client's per-member key encryption).
Author
Owner

M8 CLOSES with this issue. Scope: tasks 7.14–7.16 (groups + CLS lattice client/server) landed via the #207 align-then-adorn campaign (#210–#213) and 7.14 group surfaces; milestone-close ponytail audit #214 (20 findings) remediated via FIX-ALL #215 — six PRs (#216–#221) merged, main @ 8b45a46, staging re-deployed by the merged CD pipeline. Deferred feature items (M8-3 KEM provisioning, M8-11 streaming, M8-13 receive-envelope) + operator items tracked in #222 for re-planning. M8 done.

M8 CLOSES with this issue. Scope: tasks 7.14–7.16 (groups + CLS lattice client/server) landed via the #207 align-then-adorn campaign (#210–#213) and 7.14 group surfaces; milestone-close ponytail audit #214 (20 findings) remediated via FIX-ALL #215 — six PRs (#216–#221) merged, main @ 8b45a46, staging re-deployed by the merged CD pipeline. Deferred feature items (M8-3 KEM provisioning, M8-11 streaming, M8-13 receive-envelope) + operator items tracked in #222 for re-planning. M8 done.
Sign in to join this conversation.
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
primatekuntech/failsulit#158
No description provided.