[H-3] Unbounded client-controlled certificate validity in :preview; :released ignores config and defaults enrollment to 2 days #7

Closed
opened 2026-11-14 18:28:41 +01:00 by amiryahaya · 0 comments
Owner

Finding

In :preview license mode a caller-supplied cert_validity (e.g. [100, "year"]) is honored with no upper bound. runtime.exs defaults MDID_LICENSE to preview for bare release starts (compose saves itself with released). In :released mode the :cert_validity config is ignored entirely and enrollment defaults to {2, :day} while renewal defaults to {1, :year} — contradicting the documented 1-year leaf policy.

Evidence

  • lib/mdid_ws/cert_management/certificate_validity.ex:20-34, 79-99
  • config/runtime.exs:13-25 — default :preview
  • lib/mdid_ws/cert_management/enrollment.ex:224 — {2, :day} default

Impact

Policy bypass (certs that outlive the 25-year Root) or, in released mode, mass 2-day credential expiry + inconsistent enroll-vs-renew lifetimes.

Fix

  • Enforce a server-side maximum (≤1 year) regardless of license/mode
  • Make :cert_validity effective in :released mode with a bounded override
  • Fix enrollment default to {1, :year}; default the license to :released everywhere

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding In `:preview` license mode a caller-supplied `cert_validity` (e.g. `[100, "year"]`) is honored with **no upper bound**. `runtime.exs` defaults `MDID_LICENSE` to preview for bare release starts (compose saves itself with `released`). In `:released` mode the `:cert_validity` config is ignored entirely and enrollment defaults to `{2, :day}` while renewal defaults to `{1, :year}` — contradicting the documented 1-year leaf policy. ## Evidence - `lib/mdid_ws/cert_management/certificate_validity.ex:20-34, 79-99` - `config/runtime.exs:13-25` — default `:preview` - `lib/mdid_ws/cert_management/enrollment.ex:224` — `{2, :day}` default ## Impact Policy bypass (certs that outlive the 25-year Root) or, in released mode, mass 2-day credential expiry + inconsistent enroll-vs-renew lifetimes. ## Fix - [ ] Enforce a server-side maximum (≤1 year) regardless of license/mode - [ ] Make `:cert_validity` effective in :released mode with a bounded override - [ ] Fix enrollment default to {1, :year}; default the license to :released everywhere _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Sign in to join this conversation.
No description provided.