fix(p0): M1.5-audit P0 batch — offboarding, email squatting, suspended wallet, revoke gate, kill switch, accept grant, compose port, nightly KAZ (#102-#109) #112

Merged
amiryahaya merged 1 commit from fix/m15-p0s into main 2026-11-08 03:33:45 +01:00
Owner

Closes #102, #103, #104, #105, #106, #107, #108, #109 (the P0s from the M1.5 close audit, umbrella #101).

# Fix Before → After
#102 RemoveMember clears User.TenantId offboarded member kept full workspace access on live session → TenantId null + no_workspace 403
#103 PATCH /api/me email claim hardened arbitrary unverified write (500-oracle + permanent squat) → format 400 / taken 409 / unverified claim
#104 Wallet authenticate rejects non-Active suspended wallet identity minted sessions into the GLOBAL 10k cap (platform lockout DoS) → 403 pre-mint
#105 RevokeApiKey Owner/Admin gate any Member could kill tenant integrations → 403 (was gated for rotate but not revoke — 8.2-introduced)
#106 Tenant.Disabled enforced disabled tenant's API keys kept working → ValidateAsync returns null
#107 InvitationAcceptanceService grants TenantId logged-in accept → no_workspace → TenantId granted in-transaction
#108 compose.yml 8080:5000 first compose deploy of the CD image DOA → reachable
#109 security-nightly downloads libkazsign + guard nightly passed with ALL KAZ tests Assert.Skip → crypto coverage enforced

Also includes the suspended-wallet test (full wallet registration flow w/ matching invite email — INV-03 binding).

Verification

TDD: 11 tests first — RED ×7 deterministic (2 were self-review catches: epoch test's random KeyProofs, suspended-wallet invite-email mismatch) + 4 control tests. Suite 912 / 0 failed / 39 skipped (Release ×2 + Debug) · coverage gate 85.49% ≥ 80

Closes #102, #103, #104, #105, #106, #107, #108, #109 (the P0s from the M1.5 close audit, umbrella #101). | # | Fix | Before → After | |---|---|---| | #102 | RemoveMember clears `User.TenantId` | offboarded member kept full workspace access on live session → **TenantId null + no_workspace 403** | | #103 | PATCH /api/me email claim hardened | arbitrary unverified write (500-oracle + permanent squat) → **format 400 / taken 409 / unverified claim** | | #104 | Wallet authenticate rejects non-Active | suspended wallet identity minted sessions into the GLOBAL 10k cap (platform lockout DoS) → **403 pre-mint** | | #105 | RevokeApiKey Owner/Admin gate | any Member could kill tenant integrations → **403** (was gated for rotate but not revoke — 8.2-introduced) | | #106 | Tenant.Disabled enforced | disabled tenant's API keys kept working → **ValidateAsync returns null** | | #107 | InvitationAcceptanceService grants TenantId | logged-in accept → no_workspace → **TenantId granted in-transaction** | | #108 | compose.yml 8080:5000 | first compose deploy of the CD image DOA → **reachable** | | #109 | security-nightly downloads libkazsign + guard | nightly passed with ALL KAZ tests Assert.Skip → **crypto coverage enforced** | Also includes the suspended-wallet test (full wallet registration flow w/ matching invite email — INV-03 binding). ## Verification TDD: 11 tests first — **RED ×7** deterministic (2 were self-review catches: epoch test's random KeyProofs, suspended-wallet invite-email mismatch) + 4 control tests. Suite **912 / 0 failed / 39 skipped** (Release ×2 + Debug) · coverage gate **85.49% ≥ 80**
fix(p0): M1.5-audit P0 batch — member offboard cut, email squatting, suspended wallet, revoke gate, tenant kill switch, accept TenantId grant, compose port, nightly KAZ (#102-#109)
All checks were successful
Security CI / security-scan (pull_request) Successful in 2m15s
API CI / build-and-test (pull_request) Successful in 26m32s
a6a2be29b8
#102 — RemoveMember clears User.TenantId (was membership-row-only):
offboarded members kept full workspace access on live sessions. Also
asserts other members unaffected.

#103 — PATCH /api/me email claim hardened: MailAddress format check →
400, uniqueness pre-check → 409 (was: unverified write, taken email →
500 oracle, unused email → permanent squat blocking real registration).
Unverified claim retained for did-only accounts (LinkEmail remains the
trusted path).

#104 — wallet authenticate rejects non-Active accounts before minting
(was: suspended wallet identities burned global session capacity; the
10k in-memory cap is GLOBAL so a loop = platform sign-in lockout).

#105 — RevokeApiKey requires Owner/Admin (was: any Member could kill
tenant integrations; rotate was gated, revoke was not — introduced in
8.2/PR #100, caught by the M1.5 audit on my own code).

#106 — ApiKeyAuthentication rejects keys of Disabled tenants (the
Tenant.Disabled kill switch was stored + audited but never enforced).

#107 — InvitationAcceptanceService grants TenantId on accept (logged-in
accept path added membership only → invited member landed in
no_workspace despite 200 + tenant_id in the response).

#108 — compose.yml maps 8080:5000 (was 8080:8080; the CD-built image
listens on ASPNETCORE_URLS=http://+:5000 — first compose deploy was DOA).

#109 — security-nightly: libkazsign download + LD_LIBRARY_PATH +
existence guard (the nightly passed with ALL KAZ crypto tests
Assert.Skip — zero KAZ coverage on the nightly since creation).

TDD: 11 tests first — RED ×7 (member-cut ×2, taken-email 409, format
400, revoke gate, disabled tenant, accept TenantId) + 2 self-review
catches fixed pre-run (suspended-wallet test needed full wallet
registration flow w/ matching invite email; epoch test's random
KeyProofs). Suite 912 / 0 failed / 39 skipped (Release ×2 + Debug);
gate 85.49% ≥ 80.
Sign in to join this conversation.
No description provided.