From 9ce90d380e945b4f9e49e6695407cda4a5e85f05 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 13 Mar 2024 21:51:33 +0000 Subject: [PATCH] Differentiate between verification roots that are system-installed vs user-provided --- pkg/output/styler_tty.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkg/output/styler_tty.go b/pkg/output/styler_tty.go index c3b929c..8324aa2 100644 --- a/pkg/output/styler_tty.go +++ b/pkg/output/styler_tty.go @@ -380,11 +380,11 @@ func (s TtyStyler) certSansRenderer(cert *x509.Certificate) string { // - Print SAN info (the only difference between ServingCertChain and ClientCertChain ?) // - Verify an addr (parse as either ip or name) against the SANs & CN // TODO: builder pattern (and verifiedCertChain) -func (s TtyStyler) certChain(chain, verifiedCerts []*x509.Certificate, headCb func(cert *x509.Certificate) string) string { +func (s TtyStyler) certChain(chain, verifiedCerts []*x509.Certificate, systemRoots bool, headCb func(cert *x509.Certificate) string) string { var b IndentingBuilder head := chain[0] - b.Linef("0: PRESENTED %s", s.CertSummary(head)) + b.Linef("0: %s", s.CertSummary(head)) if headCb != nil { b.Indent() b.Block(headCb(head)) @@ -406,7 +406,11 @@ func (s TtyStyler) certChain(chain, verifiedCerts []*x509.Certificate, headCb fu // The only way I can think of to determine that is to try to validate chain[0:0], chain[0:1] etc until it validates, at which point you know 0