provisioning service hardening - ponytail round-1 deferred findings (race catch, error propagation, email lookup, claims validation) #59

Closed
opened 2026-11-05 14:02:48 +01:00 by amiryahaya · 0 comments
Owner

Follow-ups from the PR #56 ponytail review (findings 2-5, deferred at merge; 1/6/7 fixed in 7e2aa03). All in UserProvisioningService / wallet registration path:

  1. Concurrent same-identity registration -> 500 (was deliberate handling, lost in the rewire): wrap SaveChangesAsync with the IsUniqueConstraintViolation catch (move helper into the service); on violation clear tracker, re-fetch by DID/email, continue - the atomic claim already prevents double-join. Restores graceful handling on /register/verify + accept-with-wallet double-clicks/retries.
  2. Wallet path collapses all provisioning errors to generic 403 "Registration requires a valid invite code" - suspended accounts and INV-03 mismatches get the wrong message. Propagate provisioned.Error through ProvisionUser.
  3. Case-sensitive find-by-email vs lowercased writes: pre-PR mixed-case rows (wallet/OIDC stored verbatim) miss the lookup -> duplicate accounts. Compare case-insensitively; also write null not "" when a wallet identity has no email ("" dodges the Email IS NOT NULL filtered unique index semantics).
  4. Unvalidated shared_claims.email on the [SsdidPublic] /register/verify: >160 chars or garbage -> DbUpdateException 500 + junk rows. MailAddress.TryCreate + length <= 160 (match CreateInvitation); invalid claim treated as absent.

Suite baseline: 767 total / 0 failed / 39 skipped (Release). TDD per SS2: failing test first for each.

Follow-ups from the PR #56 ponytail review (findings 2-5, deferred at merge; 1/6/7 fixed in 7e2aa03). All in `UserProvisioningService` / wallet registration path: 1. **Concurrent same-identity registration -> 500** (was deliberate handling, lost in the rewire): wrap `SaveChangesAsync` with the `IsUniqueConstraintViolation` catch (move helper into the service); on violation clear tracker, re-fetch by DID/email, continue - the atomic claim already prevents double-join. Restores graceful handling on `/register/verify` + accept-with-wallet double-clicks/retries. 2. **Wallet path collapses all provisioning errors** to generic 403 "Registration requires a valid invite code" - suspended accounts and INV-03 mismatches get the wrong message. Propagate `provisioned.Error` through `ProvisionUser`. 3. **Case-sensitive find-by-email vs lowercased writes**: pre-PR mixed-case rows (wallet/OIDC stored verbatim) miss the lookup -> duplicate accounts. Compare case-insensitively; also write `null` not `""` when a wallet identity has no email (`""` dodges the `Email IS NOT NULL` filtered unique index semantics). 4. **Unvalidated `shared_claims.email`** on the [SsdidPublic] `/register/verify`: >160 chars or garbage -> DbUpdateException 500 + junk rows. `MailAddress.TryCreate` + length <= 160 (match CreateInvitation); invalid claim treated as absent. Suite baseline: 767 total / 0 failed / 39 skipped (Release). TDD per SS2: failing test first for each.
amiryahaya changed title from provisioning service hardening — ponytail round-1 deferred findings (race catch, error propagation, email lookup, claims validation) to provisioning service hardening - ponytail round-1 deferred findings (race catch, error propagation, email lookup, claims validation) 2026-11-05 14:03:15 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/failsulit#59
No description provided.