[M-9] TOCTOU races: duplicate concurrent issuance per IC, rate-limiter undercounting, duplicate client_id rows crash auth #21
Labels
No labels
architecture
code-quality
correctness
critical
docs
high
low
medium
ops
performance
privacy
security
tests
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
antrapol/CA-MDID-eMudhra#21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Finding
Check-then-act without transactions: two concurrent enrollments for the same IC both pass 'no active cert' and both issue; rate-limiter find→mutate→save lets concurrent failures undercount (and duplicate identifier rows make
{:ok, [attempt | _]}read an arbitrary one);client_idhas no unique constraint and singleton-list matching raises MatchError on duplicates.Evidence
lib/mdid_ws/cert_management/enrollment.ex:93-97 → 53(check vs save)lib/mdid_ws/auth/rate_limiter.ex:55-104lib/mdid_ws/oauth/client_credentials.ex:7—{:ok, [client]}singleton matchImpact
Duplicate active certificates per IC; lockout threshold effectively exceeded; 500s on token requests.
Fix
Line numbers refer to the initial import commit
282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).