fix(provisioning): hardening — race-safe duplicates, error propagation, email identity, claims validation (issue #59) #72
No reviewers
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!72
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/59-provision-hardening"
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?
Closes #59 — the four ponytail round-1 deferred findings (task 1.4 follow-ups), TDD: 6 failing tests first (
ProvisionHardeningTests), then green.#59.1 — race-safe duplicate registration: the unique-violation catch (lost in the task-1.4 rewire) now lives in
UserProvisioningService— on violation: clear tracker, re-fetch by DID (email fallback, case-insensitive), apply the suspended/verification-upgrade invariants, and continue. The atomic claim already prevents double-join, so double-clicks/retries land 201/409, never 500.#59.2 — error propagation:
ProvisionUserreturnsResult<User>; suspended accounts now get 403 "Your account is suspended" and INV-03 mismatches "Email does not match the invitation" instead of the generic invite-code 403. The new tests exposed an extra gap beyond the issue: the legacy existing-user re-registration path bypassedProvisionInviteeAsyncentirely — a suspended account could re-register and consume an invite. Fixed with the same invariant on that path.#59.3 — email identity: find-by-email is case-insensitive (pre-#59 rows hold mixed case from the old raw-claim writer); null is written instead of "" when a wallet identity has no email (empty strings dodge the
Email IS NOT NULLfiltered unique-index semantics).#59.4 — claims validation:
shared_claims.emailon [SsdidPublic] /register/verify — and the same client-supplied field on accept-with-wallet — is sanitized viaMailAddress.TryCreate+ ≤160 chars (matching CreateInvitation); an invalid claim is treated as absent. The #33 takeover guard's email lookup is now case-insensitive to stay correct against mixed-case rows.Suite 847/0/39 Release ×3; coverage gate 84.62% ≥ 80. With this merge, every Phase 1 task (1.1–1.13) is complete — the M1-close gate (issue #65, the first §2.6 ponytail-audit) is next.