fix(p0): M1-audit P0 batch — listings, recovery epochs, BlobSize bounds, per-IP auth limiter (#85-#88) #97

Merged
amiryahaya merged 1 commit from fix/m1-p0s into main 2026-11-07 14:50:45 +01:00
Owner

Closes #85, #86, #87, #88 (the P0s from the M1 closure audit, umbrella #84)

# Fix Before → After
#85 ListFiles accepts both terminal statuses (chunked ends uploaded, legacy defaults complete) chunked uploads invisible forever → listed (full-flow test)
#86 Recovery trust epochs: re-setup/deactivate expire outstanding Pending/Approved requests; completion queries tie to RecoverySetupId == setup.Id; approve rejects inactive setups dead-epoch trustee approvals satisfied the 2-of-3 gate → Expired
#87 UpdateFile bounds BlobSize/ChunkCount like CreateUploadUrl pending file could raise the cap past the UploadBlob guard → 400
#88 auth limiter per-IP (30/min/IP) one global 20/min bucket: morning-wave 429s + free all-auth DoS → per-client budgets

Also documents #88 as config-only (no unit-testable 429 at Testing permit levels) and includes a TDD self-review catch: the re-setup/rekey epoch test initially passed for the wrong reason (two different random KeyProofs) — fixed with a single captured K2.

Verification

TDD: RED ×8 deterministic, then implemented. Suite 881 / 0 failed / 39 skipped (Release ×2 + Debug) · coverage gate 85.12% ≥ 80

Closes #85, #86, #87, #88 (the P0s from the M1 closure audit, umbrella #84) | # | Fix | Before → After | |---|---|---| | #85 | ListFiles accepts both terminal statuses (chunked ends `uploaded`, legacy defaults `complete`) | chunked uploads invisible forever → **listed** (full-flow test) | | #86 | Recovery trust epochs: re-setup/deactivate expire outstanding Pending/Approved requests; completion queries tie to `RecoverySetupId == setup.Id`; approve rejects inactive setups | dead-epoch trustee approvals satisfied the 2-of-3 gate → **Expired** | | #87 | UpdateFile bounds BlobSize/ChunkCount like CreateUploadUrl | pending file could raise the cap past the UploadBlob guard → **400** | | #88 | `auth` limiter per-IP (30/min/IP) | one global 20/min bucket: morning-wave 429s + free all-auth DoS → per-client budgets | Also documents #88 as config-only (no unit-testable 429 at Testing permit levels) and includes a TDD self-review catch: the re-setup/rekey epoch test initially passed for the wrong reason (two different random KeyProofs) — fixed with a single captured K2. ## Verification TDD: **RED ×8** deterministic, then implemented. Suite **881 / 0 failed / 39 skipped** (Release ×2 + Debug) · coverage gate **85.12% ≥ 80**
fix(p0): M1-audit P0 batch — chunked listings, recovery epoch gate, BlobSize bounds, per-IP auth limiter (#85 #86 #87 #88)
All checks were successful
Security CI / security-scan (pull_request) Successful in 3m14s
API CI / build-and-test (pull_request) Successful in 24m3s
f675f47445
#85 — chunked uploads visible in listings (ListFiles.cs): terminal filter
now accepts both 'uploaded' (chunked terminal) and 'complete' (legacy
default); test drives upload-url → blob → update → list end to end.

#86 — recovery trust epochs (4 files): SetupRecovery regeneration and
DeleteRecoverySetup expire outstanding Pending/Approved requests
(ExecuteUpdate); RekeyRecovery + CompleteRecovery completion queries tie
to RecoverySetupId == setup.Id; ApproveRecoveryRequest rejects inactive
setups (Gone). Closes the dead-epoch trustee-approval bypass.

#87 — UpdateFile bounds BlobSize (0, ≤5 GB) and ChunkCount (1..10k)
identically to CreateUploadUrl — closes the declared-size cap bypass
(pending files could raise BlobSize past the UploadBlob guard).

#88 — 'auth' rate limiter is per-IP (30/min/IP prod, 10k/min Testing
unchanged) — was one process-global 20/min bucket shared by every
sign-in surface: morning-wave 429s + free all-auth DoS.

TDD: 8 tests first — RED ×8 deterministic (one false-pass caught in
self-review: re-setup/rekey used two different random KeyProofs —
captured a single K2 for both calls). Suite 881 / 0 failed / 39 skipped
(Release ×2 + Debug); gate 85.12% ≥ 80.
Sign in to join this conversation.
No description provided.