M8-close audit — whole-repo ponytail audit (20 findings: 11 must / 9 should) #214
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#214
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 milestone-close audit (#158 — 7.14–7.16 CLS) — 2026-11-17
Whole-repo ponytail audit per dev-plan §2.6 cadence. Four parallel deep-dives: server Files/Sharing/CLS, server Identity/Keys/Admin/infra, desktop post-#213 stack, repo lean/CI/tests. Load assumed: teams up to a few hundred users per tenant, files to 5 GB, single staging VPS.
Verdict: the CLS lattice core is correct and tested; the urgent items are two live-infra secrets, one auth fail-open, and a client key-provisioning gap that breaks folder creation. 20 numbered findings (11 must / 9 should), plus 8 runner-ups.
MUST FIX
M8-1. Live IdP admin password is a committed constant —
deploy/idp/steps.yaml:18-19+compose.staging.yml:49,73The staging IdP (idp.failsulit.com, LIVE) boots with
admin@failsulit.test/ChangeMe1!,PasswordChangeRequired: false. The repo is linked from/.well-known/security.txt. Anyone with repo access signs into the LIVE IdP as IAM_OWNER → walks the trusted/api/auth/idp/admin/*flow → mints a SuperAdmin session. Fix: rotate the password on the live instance NOW; parameterize steps.yaml from env;PasswordChangeRequired: true.M8-2.
email_verifiedfails open → invite-based account takeover —OidcTokenValidator.cs:117-118,OidcCallback.cs:86,OidcVerify.cs:132(contrastIdpCallback.cs:86-91which checks)Missing
email_verifiedclaim counts as verified (IDA-09 says reject unless true), and only IdpCallback enforces it. Case: email-less invitation + federated identity claiming the victim's address without the claim → provisioning attaches the attacker's login to the victim's account → permanent takeover. Fix: default the claim to false; reject false in all three callbacks.M8-3. KEM keys are never provisioned → folder creation always fails; subfolders impossible —
folder_keys.rs:60-68,commands/crypto.rs:126-146;Database::set_settinghas zero callers for the KEM keysFresh install: every folder create fails ("ML-KEM public key not found"); the decapsulation "primary path" is unreachable; everything rides the transitional derive fallback; shares TO this user encrypt to keys it doesn't have. Fix: generate + persist KEM keypairs at unlock/registration and publish via
PATCH /users/keys(dev-plan 2.5 partially exists — the client half is the gap).M8-4.
GET /folders/{id}/childrenskips the CLS-06 listing filter —GetFolderChildren.cs:35-40#210's "names must not read up the lattice" holds on ListFiles/ListFolders/root-contents but not /children — a demoted holder of a pre-downgrade share sees the folder name + level there. Fix:
FilterShareVisibleAsyncafter the children query (mirrorListFolders.cs:48) + parent gate likeGetFolder.cs. No test covers /children with classification on.M8-5.
CreateShareaccepts recipients from ANY tenant —CreateShare.cs:41-43No
UserTenantsmembership check onSharedWithId; the lattice read then sees rank 0 for the foreign user. Case: share an Internal file cross-tenant → 201 + notification with the real filename lands in the foreign user's list. Fix: require an active membership row, else 404.M8-6.
CreateFolderignores parent write-access;DeleteFolderrecursion then deletes cross-user data —CreateFolder.cs:66-76,DeleteFolder.cs:62-98A read-share holder can create a subfolder inside someone else's tree (invisible to the owner), store files there, and the owner's later delete destroys the foreign subtree with no guard. Fix: reuse the
UploadFilewrite-access block for parents; guard foreign-owned subtrees on delete.M8-7. Unauthenticated bootstrap race —
Bootstrap.cs:28-37/api/admin/bootstrap/setup|confirmare public until a TOTP SuperAdmin exists — and the superadmin bootstrap is still PENDING on staging. First network scanner to complete the flow owns the deployment. Fix: env-flag or one-time operator token gate.M8-8. OTP codes written to log files when email is unconfigured —
NullEmailServiceviaProgram.cs:177-189; deployment-guide documents this modeStaging runs without a Resend key → registration/TOTP-recovery OTPs at INFO into 7×50 MB logs → grep = any account within the 10-min TTL. Fix: log at Debug or redact.
M8-9. Stale closure: toolbar Upload (Ctrl+U) uploads to the wrong folder and skips the level sheet —
FilesPage.tsx:252-271(useCallback(..., []))Navigating root → subfolder keeps the mount-time
folderId/clsEnabled: files land in the ROOT and the F-CLS1 sheet never opens. Fix: deps[clsEnabled, runUpload](or a ref).M8-10. memberStore role-update/remove double
/apiand use PUT —memberStore.ts:132-137, 167-171; server isPATCH /api/tenants/...Member role changes and removals 404 every time — MembersPage management is broken. Fix: drop the segment, use PATCH (same fix loadMembers got in #212).
M8-11. Upload/download buffer whole files ~3× in RAM against a 5 GB target; download shows no progress; zeroize only on success paths —
file_service.rs:525, 555-583, 718-733Upload ≈ 15 GB peak, download ≈ 10 GB for a 5 GB file → OOM on the stated load; progress frozen 0→50→100; aborted transfers leave plaintext in freed heap. Fix: stream-encrypt to temp, streaming multipart parts, progress in the stream loop, drop-guard zeroize.
SHOULD FIX
M8-12. Desktop share-list cluster: ghost routes, unregistered commands, mock-pinned tests —
sharing_service.rs:202-239,tauri.ts:515-527(get_shares_for_item/update_share_permission/set_share_expiryunregistered), orphanedShareDetailsDialog,Sharestruct can't parse any server response (GET /shares/created|receivedare the real routes, paged). MyShares/SharedWithMe can never render. Fix: align to the real routes + DTO, delete accept/decline/PUT ghosts + orphaned dialog, add a grep-contract test (invoke strings ⊆ generate_handler).M8-13. Share key envelope never consumed on receive —
sharing_service.rs:268-284dead; recipients can't unwrap the delivered wrap → shares are one-way. Fix: decapsulate on receive + cache resolved folder keys by resource; consult before fallbacks.M8-14. Storage quota blind to multipart uploads —
TenantQuota.cs:25-27sumsBlobSize, whichUploadFile.csnever sets → legacy-path uploads are invisible to quota; one tenant can fill the staging disk. Fix:BlobSize ?? Size.M8-15.
RemoveMemberleaves GroupMemberships + live shares —RemoveMember.cs:50-70; removed users still count as group members (group-share key coverage requires keys wrapped FOR THEM) and stale grants revive on re-invite. Fix: purge memberships + revoke active shares on removal.M8-16. Only the original sharer can revoke/expire/downgrade —
RevokeShare.cs:24-25(+ permission/expiry). Owners cannot kill re-shares; a departed sharer's grants are unkillable. Fix: owner + tenant-admin may act on any active share of the resource.M8-17. Wallet credential replay unbounded + global session cap → platform lockout amplifier —
Authenticate.cs:27-42,PostgresSessionStore.cs:83. A captured authenticate request replays until VC expiry; the 10k GLOBAL session cap then 503s every login, renewable. Fix: bind to the LoginInitiate challenge (atomic consume); cap sessions per account.M8-18. OIDC replay gaps —
PostgresSessionStore.cs:60-77(racy challenge consume — two callbacks both win),/oidc/verifymints sessions from any id_token with no nonce,IdpStateServicecarries the PKCE verifier through the browser. Fix: conditional DELETE on consume; nonce on verify; verifier stays server-side.M8-19. Duplicate active shares possible; revoking one leaves the twin —
CreateShare.cs:91-96+ix_shares_activenot unique. Double-click → two rows → "revoke confirmed" but the twin still grants access. Fix: unique filtered index + 409 mapping.M8-20. Reclassification ignores the actor's clearance —
ReclassifyFile.cs:49-56/ folder twin. An Internal owner can declassify an admin-raised file or raise to Top Secret and keep inherent access — contradicts the upload-side invariant; no tests cover it. Fix:userRank >= level.Rankon lower (both directions per upload precedent) + tests.Nice to have (not numbered)
Session tokens delivered as
?token=in admin/OIDC redirects (proxy logs = credential retention — design change: one-time exchange code); WebAuthn credential flow is dead code that verifies nothing; ListFiles page/search params accepted and ignored (pinned by PaginationTests); invitation email case-sensitivity vs lowered registration emails; root/contents auto-creates a Personal tenant for any tenant-less caller (GetRootFolder disagrees); UploadFile writes blob before DB commit (orphan on failure); double-enable classification 500s; desktop dead constants + UploadLevelSheet typo; CI: stacked-PR filter blocks feature-branch PRs (bit us in #207), kaz-setup paths-filter gap, cd.yml/staging-deploy.yml duplicate builds (drifted npm ci vs install) + cancel-in-progress can kill a deploy, api-ci runs the suite twice w/o NuGet cache, security-nightly inline kaz-setup without the mirror fallback, gitleaks fetch-depth:0 with --no-git; compose api healthcheck missing + local postgres published on all interfaces; unused deps (once_cell,coverlet.collector).Not read (declared): mobile/web clients, desktop crypto internals beyond the audited surfaces, most non-classification Admin endpoints, Recovery bodies beyond the audited paths, Migrations bodies, ~70 test suites, deploy/idp beyond the quoted steps, spikes/publish.
Remediated per the 2026-11-17 scope decision: 16/20 findings fixed via #216/#217/#218/#219/#220/#221 (all merged, main @
8b45a46); M8-3/M8-11/M8-13 deferred to re-planning in #222. Audit cycle complete.