M1-audit NICE batch: 9 small findings (dead QRCoder dep, dead helper, LinkOidc message, README stale, …) #96

Open
opened 2026-11-07 08:41:32 +01:00 by amiryahaya · 2 comments
Owner

Batched nice-to-haves from the M1 closure audit (#84 umbrella):

  1. Dead QRCoder dependency — zero usages in src/tests; remove from FailSulit.Api.csproj.
  2. Dead helper RegisterVerify.IsUniqueConstraintViolation (RegisterVerify.cs:176-178) — never called; live copy is in UserProvisioningService. Also make the bare catch at RegisterVerify.cs:98 filter on the violation so transient DB failures aren't swallowed into fake-201s.
  3. LinkOidc wrong conflict message (LinkOidc.cs:43-48) — missing AccountId != accessor.UserId filter: re-linking your OWN provider reports 'linked to another account'. Mirror LinkEmail.cs:31-34.
  4. CompleteRecovery DID collision → 500 (CompleteRecovery.cs:80) — pre-check + 409 instead of unique-violation 500.
  5. RedisOtpStore BadCode expiry boundary (OtpService.cs:152-153) — non-positive TTL deletes the entry instead of counting the attempt; skip rewrite when remaining ≤ 0.
  6. No expiry sweep for pairing challenges + recovery requests — rows (with pubkey blobs) live forever; copy the InvitationExpirySweepService pattern.
  7. CreateRecoveryRequest / InitiateRecoveryRequest near-duplicates — extract shared CreateRequestCore; also duplicate using FailSulit.Api.Services; lines in both + ApproveRecoveryRequest.
  8. README stale — still documents SSDID-wallet QR auth as the sign-in flow (wallet paused; email + OIDC is live). Update the Auth Flow section.
  9. ApproveRequest returns reviewed_at always null (entity read AsNoTracking before update) — read it back or return the timestamp passed to the update.
Batched nice-to-haves from the M1 closure audit (#84 umbrella): 1. **Dead QRCoder dependency** — zero usages in src/tests; remove from FailSulit.Api.csproj. 2. **Dead helper RegisterVerify.IsUniqueConstraintViolation** (RegisterVerify.cs:176-178) — never called; live copy is in UserProvisioningService. Also make the bare catch at RegisterVerify.cs:98 filter on the violation so transient DB failures aren't swallowed into fake-201s. 3. **LinkOidc wrong conflict message** (LinkOidc.cs:43-48) — missing `AccountId != accessor.UserId` filter: re-linking your OWN provider reports 'linked to another account'. Mirror LinkEmail.cs:31-34. 4. **CompleteRecovery DID collision → 500** (CompleteRecovery.cs:80) — pre-check + 409 instead of unique-violation 500. 5. **RedisOtpStore BadCode expiry boundary** (OtpService.cs:152-153) — non-positive TTL deletes the entry instead of counting the attempt; skip rewrite when remaining ≤ 0. 6. **No expiry sweep for pairing challenges + recovery requests** — rows (with pubkey blobs) live forever; copy the InvitationExpirySweepService pattern. 7. **CreateRecoveryRequest / InitiateRecoveryRequest near-duplicates** — extract shared CreateRequestCore; also duplicate `using FailSulit.Api.Services;` lines in both + ApproveRecoveryRequest. 8. **README stale** — still documents SSDID-wallet QR auth as the sign-in flow (wallet paused; email + OIDC is live). Update the Auth Flow section. 9. **ApproveRequest returns reviewed_at always null** (entity read AsNoTracking before update) — read it back or return the timestamp passed to the update.
Author
Owner

Re-verified all 9 items against main @ 7f853c8 (2026-11-11).

FIXED / OBSOLETE (2):

  • Item 5 (RedisOtpStore expiry boundary): OBSOLETE — Redis fully removed (ADR-011, #120); PostgresOtpStore is the only IOtpStore, no StackExchange.Redis references remain.
  • Item 2 (dead helper + bare catch): helper extracted to Common/DbErrors.cs in #111; new-user path goes through UserProvisioningService with filtered DbUpdateException catches. REMAINDER: bare catch at RegisterVerify.cs:98 (existing-user invite path) still swallows all exceptions into a 201 — narrowing to unique-violation in the hygiene batch; stale orphan comment at RegisterVerify.cs:173.

STILL LIVE (7): 1 (QRCoder 1.7.0 still referenced in FailSulit.Api.csproj:25, zero usages), 3 (LinkOidc.cs:43 still lacks the AccountId != accessor.UserId filter — re-linking your own provider reports 'linked to another account'; LinkEmail.cs:31 is the correct pattern), 4 (CompleteRecovery still mapped; no NewDid pre-check — unique violation = 500), 6 (SessionCleanupService sweeps 5 tables — Sessions, SessionChallenges, TotpConsumedCodes, AuthFailureEvents, SignedStateNonces — PairingChallenge + RecoveryRequest NOT covered, rows with pubkey blobs live forever), 7 (CreateRecoveryRequest/InitiateRecoveryRequest still near-line-for-line duplicates; dup-using sub-item fixed), 8 (README.md:12 still documents wallet QR scan as the sign-in flow), 9 (ApproveRequest returns the stale AsNoTracking snapshot — reviewed_at always null in the response).

DISPOSITION: items 1, 3, 4, 6, 8, 9 + the item-2 remainder land in the hygiene batch PR today. Item 7 (recovery handler dedup) flows into the M3 recovery work alongside #95 items 6+7.

Re-verified all 9 items against main @ 7f853c8 (2026-11-11). FIXED / OBSOLETE (2): - Item 5 (RedisOtpStore expiry boundary): OBSOLETE — Redis fully removed (ADR-011, #120); PostgresOtpStore is the only IOtpStore, no StackExchange.Redis references remain. - Item 2 (dead helper + bare catch): helper extracted to Common/DbErrors.cs in #111; new-user path goes through UserProvisioningService with filtered DbUpdateException catches. REMAINDER: bare catch at RegisterVerify.cs:98 (existing-user invite path) still swallows all exceptions into a 201 — narrowing to unique-violation in the hygiene batch; stale orphan comment at RegisterVerify.cs:173. STILL LIVE (7): 1 (QRCoder 1.7.0 still referenced in FailSulit.Api.csproj:25, zero usages), 3 (LinkOidc.cs:43 still lacks the AccountId != accessor.UserId filter — re-linking your own provider reports 'linked to another account'; LinkEmail.cs:31 is the correct pattern), 4 (CompleteRecovery still mapped; no NewDid pre-check — unique violation = 500), 6 (SessionCleanupService sweeps 5 tables — Sessions, SessionChallenges, TotpConsumedCodes, AuthFailureEvents, SignedStateNonces — PairingChallenge + RecoveryRequest NOT covered, rows with pubkey blobs live forever), 7 (CreateRecoveryRequest/InitiateRecoveryRequest still near-line-for-line duplicates; dup-using sub-item fixed), 8 (README.md:12 still documents wallet QR scan as the sign-in flow), 9 (ApproveRequest returns the stale AsNoTracking snapshot — reviewed_at always null in the response). DISPOSITION: items 1, 3, 4, 6, 8, 9 + the item-2 remainder land in the hygiene batch PR today. Item 7 (recovery handler dedup) flows into the M3 recovery work alongside #95 items 6+7.
Author
Owner

PR #145 MERGED (squash 4c87be7; PR runs green). Items 1 (QRCoder), 2-remainder (bare catch + stale comment), 3 (LinkOidc messages), 4 (CompleteRecovery 409), 6 (sweep covers pairing challenges + recovery requests >24h), 8 (README auth flow), 9 (reviewed_at) are FIXED — strike from this batch. Suite 987/0/39, gate 87.20%. Item 7 (recovery handler dedup) remains, flows into M3 recovery work.

PR #145 MERGED (squash 4c87be7; PR runs green). Items 1 (QRCoder), 2-remainder (bare catch + stale comment), 3 (LinkOidc messages), 4 (CompleteRecovery 409), 6 (sweep covers pairing challenges + recovery requests >24h), 8 (README auth flow), 9 (reviewed_at) are FIXED — strike from this batch. Suite 987/0/39, gate 87.20%. Item 7 (recovery handler dedup) remains, flows into M3 recovery work.
Sign in to join this conversation.
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#96
No description provided.