From a326f5cb18bea1decaf3863780b4418e548b33e9 Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Tue, 26 Nov 2024 13:36:51 -0700 Subject: [PATCH] drop table view Signed-off-by: Meredith Lancaster --- pkg/cmd/attestation/io/handler.go | 4 ---- pkg/cmd/attestation/verification/policy.go | 27 ---------------------- pkg/cmd/attestation/verify/verify.go | 13 +---------- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/pkg/cmd/attestation/io/handler.go b/pkg/cmd/attestation/io/handler.go index e7ff4b631..9664c7f65 100644 --- a/pkg/cmd/attestation/io/handler.go +++ b/pkg/cmd/attestation/io/handler.go @@ -29,10 +29,6 @@ func NewTestHandler() *Handler { return NewHandler(testIO) } -func (h *Handler) DebugEnabled() bool { - return h.debugEnabled -} - // Printf writes the formatted arguments to the stderr writer. func (h *Handler) Printf(f string, v ...interface{}) (int, error) { if !h.IO.IsStdoutTTY() { diff --git a/pkg/cmd/attestation/verification/policy.go b/pkg/cmd/attestation/verification/policy.go index 966dd9e9f..845b0a207 100644 --- a/pkg/cmd/attestation/verification/policy.go +++ b/pkg/cmd/attestation/verification/policy.go @@ -82,30 +82,3 @@ The following policy criteria will be enforced against all attestations: return template } - -func (c EnforcementCriteria) BuildPolicyInformationForTable() [][]string { - predicateInfo := []string{"Predicate type", c.PredicateType} - issuerInfo := []string{"Issuer", c.Certificate.Issuer} - ownerURIInfo := []string{"SourceRepositoryOwnerURI", c.Certificate.SourceRepositoryOwnerURI} - info := [][]string{predicateInfo, issuerInfo, ownerURIInfo} - - if c.Certificate.SourceRepositoryURI != "" { - sourceRepoURIInfo := []string{"SourceRepositoryURI", c.Certificate.SourceRepositoryURI} - info = append(info, sourceRepoURIInfo) - } - - if c.Certificate.RunnerEnvironment == GitHubRunner { - runnerInfo := []string{"RunnerEnvironment", c.Certificate.RunnerEnvironment} - info = append(info, runnerInfo) - } - - if c.SAN != "" { - sanInfo := []string{"SAN", c.SAN} - info = append(info, sanInfo) - } else if c.SANRegex != "" { - sanRegexInfo := []string{"SANRegex", c.SANRegex} - info = append(info, sanRegexInfo) - } - - return info -} diff --git a/pkg/cmd/attestation/verify/verify.go b/pkg/cmd/attestation/verify/verify.go index 2dc6b9422..d332dd1ab 100644 --- a/pkg/cmd/attestation/verify/verify.go +++ b/pkg/cmd/attestation/verify/verify.go @@ -243,18 +243,7 @@ func runVerify(opts *Options) error { attestations = filteredAttestations // print information about the policy that will be enforced against attestations - if opts.Logger.DebugEnabled() { - policyTableInfo := ec.BuildPolicyInformationForTable() - headers := []string{"attribute", "must match"} - opts.Logger.Println("") - if err = opts.Logger.PrintTable(headers, policyTableInfo); err != nil { - opts.Logger.Println(opts.Logger.ColorScheme.Red("failed to print policy information to table")) - return err - } - opts.Logger.Println("") - } else { - opts.Logger.Println(ec.BuildPolicyInformation()) - } + opts.Logger.Println(ec.BuildPolicyInformation()) verified, errMsg, err := verifyAttestations(*artifact, attestations, opts.SigstoreVerifier, ec) if err != nil {