Batch B3: hardening nits #31–#35 #56

Merged
amiryahaya merged 3 commits from fix/b3-hardening-nits into main 2026-11-15 12:45:38 +01:00
Owner

Batch B3: low-severity hardening, #31–#35

#31 No default RELEASE_COOKIE (compose requires it, start-docker-prod.sh rejects empty/CHANGE_ME, dev script exports a dev-only cookie); mix precommit no longer runs deps.unlock --unused (stops mutating mix.lock); mix.exs warns when sibling path deps are auto-selected.
#32 Docs: removed advertised mdidtest credentials, Alpine claims and the deprecated script reference; documented OCSP expired→good. The audit's "MyKad validation is absent" claim is stale — SubjectValidator (batch A2) enforces it — so the MyKad docs stay.
#33 Live Trustgate tests tagged :trustgate, excluded unless TRUSTGATE_INTEGRATION=1 (run TRUSTGATE_INTEGRATION=1 mix test_named to include).
#34 SOAP debug logs redact names, IC, CSR, certificate material (also prefixed/attributed tags and HTTP error bodies); lazy debug logging; telemetry: SOAP span, [:mdid_ws,:cert,:issued] (enroll + renew), [:mdid_ws,:cert,:revoked], metric definitions.
#35 Serial first byte via rejection sampling; OCSP responses signed ECDSA/SHA-256 (was SHA-384 with a P-256 key). Decimal-serial fallback left (Trustgate reports decimal serials) and documented.

Not done / caveats

  • #34: no telemetry reporter wired (needs an ops choice); no correlation-id work beyond the existing request_id; SOAP-only (remote-only) revocations are not counted.
  • #35: stored decimal-vs-hex serial ambiguity only documented; SOAP debug logs stay verbose in structure.
  • mix.exs warning prints on every mix invocation when sibling deps exist. Compose with -f … -f dev needs RELEASE_COOKIE exported (the dev script does); compose accepts a literal CHANGE_ME (only the prod script rejects it).
  • Known flake: TokenRevocationTest "token without a jti" failed twice in full runs, passes in isolation (cause not found).

Review

Pass 1 (ponytail) and Pass 2 done. Pass 2 caught that I had wrongly removed MyKad docs (restored). Final fixes not re-reviewed by a second Pass 1.

Tests / coverage

293 pass, 4 excluded (:trustgate), 0 failing in the last full run. New tests: redaction, SOAP telemetry, issued/revoked telemetry, serial first byte. CertSerialNumber 82%, NationalIDClient ~78%, total ~74%.

🤖 Generated with Claude Code

## Batch B3: low-severity hardening, #31–#35 **#31** No default `RELEASE_COOKIE` (compose requires it, `start-docker-prod.sh` rejects empty/`CHANGE_ME`, dev script exports a dev-only cookie); `mix precommit` no longer runs `deps.unlock --unused` (stops mutating `mix.lock`); `mix.exs` warns when sibling path deps are auto-selected. **#32** Docs: removed advertised `mdidtest` credentials, Alpine claims and the deprecated script reference; documented OCSP expired→good. The audit's "MyKad validation is absent" claim is **stale** — `SubjectValidator` (batch A2) enforces it — so the MyKad docs stay. **#33** Live Trustgate tests tagged `:trustgate`, excluded unless `TRUSTGATE_INTEGRATION=1` (run `TRUSTGATE_INTEGRATION=1 mix test_named` to include). **#34** SOAP debug logs redact names, IC, CSR, certificate material (also prefixed/attributed tags and HTTP error bodies); lazy debug logging; telemetry: SOAP span, `[:mdid_ws,:cert,:issued]` (enroll + renew), `[:mdid_ws,:cert,:revoked]`, metric definitions. **#35** Serial first byte via rejection sampling; OCSP responses signed ECDSA/SHA-256 (was SHA-384 with a P-256 key). Decimal-serial fallback left (Trustgate reports decimal serials) and documented. ### Not done / caveats - #34: no telemetry reporter wired (needs an ops choice); no correlation-id work beyond the existing `request_id`; SOAP-only (remote-only) revocations are not counted. - #35: stored decimal-vs-hex serial ambiguity only documented; SOAP debug logs stay verbose in structure. - `mix.exs` warning prints on every mix invocation when sibling deps exist. Compose with `-f … -f dev` needs `RELEASE_COOKIE` exported (the dev script does); compose accepts a literal `CHANGE_ME` (only the prod script rejects it). - Known flake: `TokenRevocationTest` "token without a jti" failed twice in full runs, passes in isolation (cause not found). ### Review Pass 1 (ponytail) and Pass 2 done. Pass 2 caught that I had wrongly removed MyKad docs (restored). Final fixes not re-reviewed by a second Pass 1. ### Tests / coverage 293 pass, 4 excluded (`:trustgate`), 0 failing in the last full run. New tests: redaction, SOAP telemetry, issued/revoked telemetry, serial first byte. CertSerialNumber 82%, NationalIDClient ~78%, total ~74%. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix: B3 pass-2 review — restore MyKad docs (validation exists), lazy debug logs, revoked reason tag
All checks were successful
Lint / lint (pull_request) Successful in 2m46s
Security / Dependency advisories (mix hex.audit) (pull_request) Successful in 31s
Security / Secret scan (gitleaks) (pull_request) Successful in 11s
Unit tests / test (pull_request) Successful in 3m26s
970fb5bcfc
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.