fix(m2m,identity,files): #111 NICE batch — node drift, dedup helper, suspended-SA 403, setup-confirm guard, blob best-effort #139

Merged
amiryahaya merged 1 commit from feat/111-nice-batch into main 2026-11-10 07:24:59 +01:00
Owner

All five M1.5-audit NICE findings (#111), small and surgical:

  1. Node drift: desktop-release.yml node 20 → 22 — the release toolchain now matches the gating CI.
  2. Helper dedup: IsUniqueConstraintViolation moved to FailSulit.Api.Common.DbErrors (was copy-pasted in RegisterVerify + UserProvisioningService).
  3. Suspended SA: authenticated-but-rejected is now 403 (401 lied about the failure mode), counts against the per-IP budget (suspended-SA loops throttle), security.audit row.
  4. TotpSetupConfirm hardening: the confirm route had NO limiter, NO lockout, NO replay discipline, and backup-code comparison wasn't constant-time — a latent brute-force surface on TOTP enrollment. Now: auth-totp limiter, full TotpSecurityGuard (5 bad confirm codes lock even the VALID code — tested), VerifyBackupCode full-scan FixedTimeEquals preserving case-insensitive matching (regression caught + fixed in-slice).
  5. Blob I/O honesty: committed deletes no longer 500 on storage failures (DeleteFile best-effort; DeleteFolder no longer skips remaining blobs on one throw); DownloadFile with committed-row-but-missing-blob → 404.

Tests: 3 new (NiceBatchTests) — suspended-SA 403, missing-blob 404, confirm lockout. Suite 980/0/39 (Release+Debug), coverage 87.74%. Closes #111.

All five M1.5-audit NICE findings (#111), small and surgical: 1. **Node drift**: desktop-release.yml node 20 → 22 — the release toolchain now matches the gating CI. 2. **Helper dedup**: IsUniqueConstraintViolation moved to FailSulit.Api.Common.DbErrors (was copy-pasted in RegisterVerify + UserProvisioningService). 3. **Suspended SA**: authenticated-but-rejected is now 403 (401 lied about the failure mode), counts against the per-IP budget (suspended-SA loops throttle), security.audit row. 4. **TotpSetupConfirm hardening**: the confirm route had NO limiter, NO lockout, NO replay discipline, and backup-code comparison wasn't constant-time — a latent brute-force surface on TOTP enrollment. Now: auth-totp limiter, full TotpSecurityGuard (5 bad confirm codes lock even the VALID code — tested), VerifyBackupCode full-scan FixedTimeEquals preserving case-insensitive matching (regression caught + fixed in-slice). 5. **Blob I/O honesty**: committed deletes no longer 500 on storage failures (DeleteFile best-effort; DeleteFolder no longer skips remaining blobs on one throw); DownloadFile with committed-row-but-missing-blob → 404. **Tests:** 3 new (NiceBatchTests) — suspended-SA 403, missing-blob 404, confirm lockout. Suite 980/0/39 (Release+Debug), coverage 87.74%. Closes #111.
fix(m2m,identity,files): #111 NICE batch — node drift, dedup helper, suspended-SA 403, setup-confirm guard, blob best-effort
All checks were successful
Security CI / security-scan (pull_request) Successful in 2m12s
API CI / build-and-test (pull_request) Successful in 10m22s
1b67b442a4
#111-1: desktop-release.yml node 20 → 22 — release toolchain matches the
gating CI (admin-ci/desktop-ci/cd).

#111-2: IsUniqueConstraintViolation deduplicated into
FailSulit.Api.Common.DbErrors (was copy-pasted in RegisterVerify +
UserProvisioningService).

#111-3: suspended/rejected service-account auth is 403
(authenticated-but-rejected — 401 lied), counts against the per-IP
budget (suspended-SA loops throttle), and leaves a security audit row.

#111-4: /totp/setup/confirm was an ungated brute-force surface (wrong
codes unlimited, no replay/lockout discipline, backup-code compare not
constant-time). Now: auth-totp limiter, TotpSecurityGuard (lockout +
replay + failure ladder — 5 bad confirm codes lock even the VALID code),
and VerifyBackupCode scans every code with FixedTimeEquals while
preserving case-insensitive matching.

#111-5: storage failures during committed deletes are best-effort
(DeleteFile swallows + continues; DeleteFolder no longer skips the
remaining blobs on one throw); DownloadFile with a committed row but
missing blob → 404, not 500.

3 new tests (NiceBatchTests): suspended-SA 403 + budgeted, missing-blob
download 404, setup-confirm lockout even for the valid code. Suite
980/0/39 Release+Debug, coverage 87.74%.
Sign in to join this conversation.
No description provided.