[DUP-3] Small duplicates: serial-lookup loop, pem_to_der_b64, issuer-CN filter ×3, SOAP retry ladder, hash_secret/generate_secret, base-URL default ×3, XML escaping lib↔script #38
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#38
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
The
CertSerialNumber.lookup_variants |> Enum.reduce_whilelookup is duplicated controller↔OCSP responder;pem_to_der_b64/1verbatim ×2; the optional-issuer-CN filter exists ×3; the SOAP check-then-retry-with-issuer ladder ×2 (+test);hash_secret/generate_secretduplicated client_credentials↔token; thehttps://mdidws.mypqc.com.mydefault string ×3 (see M-14); XML escaping duplicated between national_id_client.ex and scripts/10_soap_enroll.sh.Evidence
cert_management_controller.ex:216-226vsocsp_responder.ex:142-153;renewal.ex:572-579vscert_management_controller.ex:633-640;renewal.ex:436-441vscert_management_controller.ex:354-359, 597-601;enrollment.ex:99-124vsrenewal.ex:268-289;client_credentials.ex:24-26, 56-58vstoken.ex:138-144;crl_publisher.ex:49/ocsp_responder.ex:15/issuer_manager.ex:23;national_id_client.ex:397-405vsscripts/10_soap_enroll.sh:64-69Impact
Divergence risk on every copy; the base-URL trio directly causes M-14.
Fix
Line numbers refer to the initial import commit
282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).Closing as done. B6 (PR #59) fixed the real duplication: serial lookup, PEM helper, issuer-CN filter, secret hashing, base-URL default. Two items are intentionally not unified. (1) The SOAP check-then-retry ladders in enrollment.ex and renewal.ex differ on purpose: enrollment lets the issuer lookup decide when the IC-only lookup fails; renewal fails closed on the first failure (#23). A shared helper would change that or add a SOAP call per failure. Pinned by two tests in the test PR. (2) XML escaping in national_id_client.ex vs scripts/10_soap_enroll.sh is Elixir vs shell; it cannot share code.