fix(api-files): M8 audit batch 3 — children filter, parent write-access, delete guard, quota, reclassify cap, invitation normalization (#214) #218

Merged
amiryahaya merged 1 commit from fix/m8-api-files into main 2026-11-17 13:37:53 +01:00
Owner

M8-close audit remediation batch 3 (#214 findings M8-4, M8-6, M8-14, M8-20 + runner-up).

M8-4 (lattice bypass): GET /folders/{id}/children now applies FilterShareVisibleAsync — the #210 per-row filter skipped this surface, so a demoted share holder could still read folder names + levels there that every other listing hides.

M8-6 (cross-user data loss): CreateFolder requires write access on the parent (owner / tenant-root / active write share — the UploadFile rule); DeleteFolder refuses with 409 while foreign-owned subfolders exist in the tree (a read-share holder could plant invisible subfolders whose content the owner's later delete destroyed).

M8-14 (quota blind spot): TenantQuota counts Size when BlobSize is unset — legacy multipart uploads were invisible to quota (a tenant could fill the staging disk without tripping it).

M8-20 (lattice integrity): ReclassifyFile/Folder refuse levels above the actor's clearance — previously an Internal-clearance owner could declassify admin-raised content or raise to Top Secret and keep inherent access. No tests covered reclassify clearance; one added, and the legacy owner-raise test updated to grant clearance first (it encoded the old behavior).

Runner-up: CreateInvitation normalizes the email — registration lowercases emails and HandleReceived matches exactly, so mixed-case invites never surfaced for their recipient.

Tests: M8AuditFixTests (6) — children hide/keep, parent access 403/allowed, delete 409-then-success, quota counts legacy rows, reclassify 403/allowed, mixed-case invitation surfacing. Full suite 1088 green.

Part of the M8-close FIX-ALL (umbrella #215, audit #214). M8-19 (unique active-share index) lands with the sharing batch.

M8-close audit remediation batch 3 (#214 findings M8-4, M8-6, M8-14, M8-20 + runner-up). **M8-4 (lattice bypass)**: GET /folders/{id}/children now applies FilterShareVisibleAsync — the #210 per-row filter skipped this surface, so a demoted share holder could still read folder names + levels there that every other listing hides. **M8-6 (cross-user data loss)**: CreateFolder requires write access on the parent (owner / tenant-root / active write share — the UploadFile rule); DeleteFolder refuses with 409 while foreign-owned subfolders exist in the tree (a read-share holder could plant invisible subfolders whose content the owner's later delete destroyed). **M8-14 (quota blind spot)**: TenantQuota counts Size when BlobSize is unset — legacy multipart uploads were invisible to quota (a tenant could fill the staging disk without tripping it). **M8-20 (lattice integrity)**: ReclassifyFile/Folder refuse levels above the actor's clearance — previously an Internal-clearance owner could declassify admin-raised content or raise to Top Secret and keep inherent access. No tests covered reclassify clearance; one added, and the legacy owner-raise test updated to grant clearance first (it encoded the old behavior). **Runner-up**: CreateInvitation normalizes the email — registration lowercases emails and HandleReceived matches exactly, so mixed-case invites never surfaced for their recipient. Tests: M8AuditFixTests (6) — children hide/keep, parent access 403/allowed, delete 409-then-success, quota counts legacy rows, reclassify 403/allowed, mixed-case invitation surfacing. Full suite 1088 green. Part of the M8-close FIX-ALL (umbrella #215, audit #214). M8-19 (unique active-share index) lands with the sharing batch.
fix(api-files): M8 audit batch 3 — children filter, parent write-access, delete guard, quota, reclassify cap, invitation normalization (#214)
All checks were successful
API CI / build-and-test (pull_request) Successful in 4m59s
API CI / migrations (pull_request) Successful in 2m24s
Security CI / security-scan (pull_request) Successful in 2m4s
f8bdba1814
M8-4: GET /folders/{id}/children now applies FilterShareVisibleAsync —
share-granted children whose level exceeds the recipient's clearance
drop from the listing (the #210 filter skipped this surface, leaking
names+levels every other listing hides).

M8-6: CreateFolder requires write access on the parent (owner /
tenant-root / active write share — the UploadFile rule); DeleteFolder
refuses with 409 while foreign-owned subfolders exist in the tree
(write-share holders' content is no longer destroyed silently).

M8-14: TenantQuota counts Size when BlobSize is unset — legacy multipart
rows were invisible to quota (one tenant could fill the staging disk).

M8-20: ReclassifyFile/Folder refuse levels above the actor's clearance
(mirror of the upload override cap — previously an Internal owner could
declassify admin-raised content or raise to Top Secret).

Runner-up: CreateInvitation normalizes the email once — registration
lowercases emails and HandleReceived matches exactly, so mixed-case
invites never surfaced for their recipient.

Tests: M8AuditFixTests (6) — children filter hide/keep, parent access
403/allowed, delete 409-then-success, quota counts legacy rows,
reclassify 403/allowed, mixed-case invitation surfacing. Suite 1084+6
green.
Sign in to join this conversation.
No description provided.