fix(pilot-ca): add DNSName validation to verifyChain (PILOT-140)#6
Conversation
verifyChain previously omitted DNSName from x509.VerifyOptions, meaning any SAN in the leaf cert passed — the function only verified chain-of-trust and expiry. Added an optional hostname parameter: when provided, it is set as VerifyOptions.DNSName so x509.Verify rejects leaves whose SAN does not match. CLI: pilot-ca verify <root.crt> <leaf.crt> [hostname] The hostname argument is optional (backward-compatible).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🤖 Change Analysis —
|
🤖 CI Status
2/3 passing — codecov/patch is informational (coverage target not met on the diff) and is non-blocking. Canary: not-yet-triggered (pilot-ca has no canary scenarios defined in repos.yaml) |
🧹 Matthew Cleanup — #6 PILOT-140PR merged by @TeoSlayer at 2026-05-28T18:11:39Z. Feature branch ✅ PILOT-140 shipped. |
Summary
verifyChainpreviously omittedDNSNamefromx509.VerifyOptions, meaning any SAN in the leaf cert passed — the function only verified chain-of-trust and expiry.Fix
Added an optional
hostnameparameter toverifyChain. When provided, it is set asVerifyOptions.DNSNamesox509.Verifyrejects leaves whose SAN does not match the expected hostname.CLI change
Backward-compatible: omitting hostname skips DNSName validation (chain-only, same as before).
Testing
x509: certificate is valid for X, not Ygo vetcleanTicket
PILOT-140— pilot-ca verifyChain doesnt validate DNSName