[H-6] Full-table scans on every hot path — no Mnesia indexes on certificate_request / oauth_client; login_attempt index unused #10
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#10
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
Lookups are
match_objectfull scans.certificate_requesthas no index onic_number/serial, so every status check, enrollment pre-check, OCSP request (×2 scans) and CRL rebuild is O(all certs ever issued).oauth_clientscans per JWT verification.login_attemptcreates an index butfindstill full-scans.Evidence
lib/mdid_ws/cert_management/certificate_request_data_store.ex:91-101— match_object patternslib/mdid_ws/cert_management/ocsp_responder.ex:142-153— two scans per OCSP requestlib/mdid_ws/cert_management/crl_publisher.ex:97-106— full scan per revocationlib/mdid_ws/oauth/client_data_store.ex:111-123;lib/mdid_ws/auth/login_attempt_data_store.ex:79-81, 135Impact
A CA's issuance table grows monotonically — OCSP/status latency degrades linearly for relying parties; every auth request scans the client table.
Fix
index: [:ic_number, :cert_serialnumber]to certificate_request (with atransform_tablemigration like the existing legacy one) andindex: [:client_id]to oauth_client:mnesia.index_readin the find clausesLine numbers refer to the initial import commit
282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).