Skip to content

fix(pilot-ca): add DNSName validation to verifyChain (PILOT-140)#6

Merged
TeoSlayer merged 1 commit into
mainfrom
openclaw/pilot-140-20260528-174900
May 28, 2026
Merged

fix(pilot-ca): add DNSName validation to verifyChain (PILOT-140)#6
TeoSlayer merged 1 commit into
mainfrom
openclaw/pilot-140-20260528-174900

Conversation

@matthew-pilot
Copy link
Copy Markdown
Collaborator

Summary

verifyChain previously omitted DNSName from x509.VerifyOptions, meaning any SAN in the leaf cert passed — the function only verified chain-of-trust and expiry.

Fix

Added an optional hostname parameter to verifyChain. When provided, it is set as VerifyOptions.DNSName so x509.Verify rejects leaves whose SAN does not match the expected hostname.

CLI change

pilot-ca verify <root.crt> <leaf.crt> [hostname]

Backward-compatible: omitting hostname skips DNSName validation (chain-only, same as before).

Testing

  • All existing tests pass
  • Manual verification: correct hostname → passes, wrong hostname → correctly rejected with x509: certificate is valid for X, not Y
  • go vet clean

Ticket

PILOT-140 — pilot-ca verifyChain doesnt validate DNSName

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
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main.go 81.25% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@matthew-pilot
Copy link
Copy Markdown
Collaborator Author

🤖 Change Analysis — fix(pilot-ca): add DNSName validation to verifyChain

What changed (+33 / −18 across 3 files):

  • main.go — Added optional hostname parameter to the verify subcommand. When supplied, x509.VerifyOptions.DNSName is set, so x509.Verify rejects leaves whose SAN does not match the expected hostname.
  • zz_branches_test.go, zz_pilot_ca_test.go — Updated call sites to pass "" (empty hostname) for backward-compatible chain-only verification.

Backward compatibility: Fully preserved — omitting the 4th [hostname] arg defaults to chain-only validation, identical to previous behavior.

Safety: The change is narrow (one function signature + one option field) and all existing tests pass unchanged. The CLI help text and usage output are updated accordingly.

@matthew-pilot
Copy link
Copy Markdown
Collaborator Author

🤖 CI Status

Check Result
test ✅ pass (39s)
security/snyk ✅ pass
codecov/patch ❌ fail (coverage delta)

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)

@TeoSlayer TeoSlayer merged commit 76f4e02 into main May 28, 2026
2 of 3 checks passed
@TeoSlayer TeoSlayer deleted the openclaw/pilot-140-20260528-174900 branch May 28, 2026 18:11
@matthew-pilot
Copy link
Copy Markdown
Collaborator Author

🧹 Matthew Cleanup — #6 PILOT-140

PR merged by @TeoSlayer at 2026-05-28T18:11:39Z. Feature branch openclaw/pilot-140-20260528-174900 already deleted (clean). Nothing to do.

✅ PILOT-140 shipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants