From 35355daf2d454005237add23e77166d4dafafbc7 Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Wed, 29 Nov 2023 14:22:33 +0000 Subject: [PATCH 1/6] refactoring error structuring --- cmd/config.go | 8 +++++--- cmd/keyloader.go | 6 ++++-- cmd/root.go | 2 +- cmd/sign.go | 4 ++-- cmd/verify.go | 2 +- options/run.go | 7 +++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index ae1d4e13..6be94be2 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -44,7 +44,7 @@ func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error } if err := v.ReadInConfig(); err != nil { - return fmt.Errorf("failed to read config file: %s", err) + return fmt.Errorf("failed to read config file: %w", err) } //Currently we do not accept configuration for root commands @@ -64,14 +64,16 @@ func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error if len(configValue) > 0 { configValueStr := strings.Join(configValue, ",") if err := flags.Set(f.Name, configValueStr); err != nil { - log.Errorf("failed to set config value: %s", err) + err := fmt.Errorf("failed to set config value: %w", err) + log.Error(err) } } } else { configValue := v.GetString(configKey) if configValue != "" { if err := flags.Set(f.Name, configValue); err != nil { - log.Errorf("failed to set config value: %s", err) + err := fmt.Errorf("failed to set config value: %w", err) + log.Error(err) } } } diff --git a/cmd/keyloader.go b/cmd/keyloader.go index 467c3a8f..be70b637 100644 --- a/cmd/keyloader.go +++ b/cmd/keyloader.go @@ -52,13 +52,15 @@ func loadSigners(ctx context.Context, so options.SignerOptions, signerProviders setters := so[signerProvider] sp, err := signer.NewSignerProvider(signerProvider, setters...) if err != nil { - log.Errorf("failed to create %v signer provider: %w", signerProvider, err) + err := fmt.Errorf("failed to create %v signer provider: %w", signerProvider, err) + log.Error(err) continue } s, err := sp.Signer(ctx) if err != nil { - log.Errorf("failed to create %v signer: %w", signerProvider, err) + err := fmt.Errorf("failed to create %v signer: %w", signerProvider, err) + log.Error(err) continue } diff --git a/cmd/root.go b/cmd/root.go index c0c05e82..1bbf7fd9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -71,7 +71,7 @@ func loadOutfile(outFilePath string) (*os.File, error) { if outFilePath != "" { out, err = os.Create(outFilePath) if err != nil { - return nil, fmt.Errorf("failed to create output file: %v", err) + return nil, fmt.Errorf("failed to create output file: %w", err) } } diff --git a/cmd/sign.go b/cmd/sign.go index 12459d4e..d9b74232 100644 --- a/cmd/sign.go +++ b/cmd/sign.go @@ -42,7 +42,7 @@ func SignCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { signers, err := loadSigners(cmd.Context(), so.SignerOptions, signerProvidersFromFlags(cmd.Flags())) if err != nil { - return fmt.Errorf("failed to load signer: %v", err) + return fmt.Errorf("failed to load signer: %w", err) } return runSign(cmd.Context(), so, signers...) @@ -71,7 +71,7 @@ func runSign(ctx context.Context, so options.SignOptions, signers ...cryptoutil. inFile, err := os.Open(so.InFilePath) if err != nil { - return fmt.Errorf("failed to open file to sign: %v", err) + return fmt.Errorf("failed to open file to sign: %w", err) } outFile, err := loadOutfile(so.OutFilePath) diff --git a/cmd/verify.go b/cmd/verify.go index e19980e5..ec9e90bc 100644 --- a/cmd/verify.go +++ b/cmd/verify.go @@ -77,7 +77,7 @@ func runVerify(ctx context.Context, vo options.VerifyOptions) error { inFile, err := os.Open(vo.PolicyFilePath) if err != nil { - return fmt.Errorf("failed to open file to sign: %v", err) + return fmt.Errorf("failed to open file to sign: %w", err) } defer inFile.Close() diff --git a/options/run.go b/options/run.go index 4b0119e7..e17b9619 100644 --- a/options/run.go +++ b/options/run.go @@ -15,6 +15,7 @@ package options import ( + "fmt" "github.com/spf13/cobra" "github.com/testifysec/go-witness/attestation" "github.com/testifysec/go-witness/log" @@ -55,12 +56,14 @@ func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivist to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { - log.Debugf("failed to hide enable-archivist flag: %v", err) + err := fmt.Errorf("failed to hide enable-archivist flag: %v", err) + log.Debug(err) } cmd.Flags().StringVar(&o.Url, "archivista-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations") cmd.Flags().StringVar(&o.Url, "archivist-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("archivist-server"); err != nil { - log.Debugf("failed to hide archivist-server flag: %v", err) + err := fmt.Errorf("failed to hide archivist-server flag: %v", err) + log.Debug(err) } } From d378c74d30d0b19d5a41d2d02735435dd27e57e2 Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Wed, 29 Nov 2023 14:33:57 +0000 Subject: [PATCH 2/6] fixing formatting directive --- options/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/run.go b/options/run.go index e17b9619..172eb4c3 100644 --- a/options/run.go +++ b/options/run.go @@ -56,14 +56,14 @@ func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivist to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { - err := fmt.Errorf("failed to hide enable-archivist flag: %v", err) + err := fmt.Errorf("failed to hide enable-archivist flag: %w", err) log.Debug(err) } cmd.Flags().StringVar(&o.Url, "archivista-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations") cmd.Flags().StringVar(&o.Url, "archivist-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("archivist-server"); err != nil { - err := fmt.Errorf("failed to hide archivist-server flag: %v", err) + err := fmt.Errorf("failed to hide archivist-server flag: %w", err) log.Debug(err) } } From df5d220508ee890c0478d4910c40ef91409b9ea5 Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Wed, 29 Nov 2023 14:22:33 +0000 Subject: [PATCH 3/6] refactoring error structuring Signed-off-by: chaosinthecrd --- cmd/config.go | 8 +++++--- cmd/keyloader.go | 6 ++++-- cmd/root.go | 2 +- cmd/sign.go | 4 ++-- cmd/verify.go | 2 +- options/run.go | 7 +++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index ae1d4e13..6be94be2 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -44,7 +44,7 @@ func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error } if err := v.ReadInConfig(); err != nil { - return fmt.Errorf("failed to read config file: %s", err) + return fmt.Errorf("failed to read config file: %w", err) } //Currently we do not accept configuration for root commands @@ -64,14 +64,16 @@ func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error if len(configValue) > 0 { configValueStr := strings.Join(configValue, ",") if err := flags.Set(f.Name, configValueStr); err != nil { - log.Errorf("failed to set config value: %s", err) + err := fmt.Errorf("failed to set config value: %w", err) + log.Error(err) } } } else { configValue := v.GetString(configKey) if configValue != "" { if err := flags.Set(f.Name, configValue); err != nil { - log.Errorf("failed to set config value: %s", err) + err := fmt.Errorf("failed to set config value: %w", err) + log.Error(err) } } } diff --git a/cmd/keyloader.go b/cmd/keyloader.go index 467c3a8f..be70b637 100644 --- a/cmd/keyloader.go +++ b/cmd/keyloader.go @@ -52,13 +52,15 @@ func loadSigners(ctx context.Context, so options.SignerOptions, signerProviders setters := so[signerProvider] sp, err := signer.NewSignerProvider(signerProvider, setters...) if err != nil { - log.Errorf("failed to create %v signer provider: %w", signerProvider, err) + err := fmt.Errorf("failed to create %v signer provider: %w", signerProvider, err) + log.Error(err) continue } s, err := sp.Signer(ctx) if err != nil { - log.Errorf("failed to create %v signer: %w", signerProvider, err) + err := fmt.Errorf("failed to create %v signer: %w", signerProvider, err) + log.Error(err) continue } diff --git a/cmd/root.go b/cmd/root.go index c0c05e82..1bbf7fd9 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -71,7 +71,7 @@ func loadOutfile(outFilePath string) (*os.File, error) { if outFilePath != "" { out, err = os.Create(outFilePath) if err != nil { - return nil, fmt.Errorf("failed to create output file: %v", err) + return nil, fmt.Errorf("failed to create output file: %w", err) } } diff --git a/cmd/sign.go b/cmd/sign.go index 12459d4e..d9b74232 100644 --- a/cmd/sign.go +++ b/cmd/sign.go @@ -42,7 +42,7 @@ func SignCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { signers, err := loadSigners(cmd.Context(), so.SignerOptions, signerProvidersFromFlags(cmd.Flags())) if err != nil { - return fmt.Errorf("failed to load signer: %v", err) + return fmt.Errorf("failed to load signer: %w", err) } return runSign(cmd.Context(), so, signers...) @@ -71,7 +71,7 @@ func runSign(ctx context.Context, so options.SignOptions, signers ...cryptoutil. inFile, err := os.Open(so.InFilePath) if err != nil { - return fmt.Errorf("failed to open file to sign: %v", err) + return fmt.Errorf("failed to open file to sign: %w", err) } outFile, err := loadOutfile(so.OutFilePath) diff --git a/cmd/verify.go b/cmd/verify.go index e19980e5..ec9e90bc 100644 --- a/cmd/verify.go +++ b/cmd/verify.go @@ -77,7 +77,7 @@ func runVerify(ctx context.Context, vo options.VerifyOptions) error { inFile, err := os.Open(vo.PolicyFilePath) if err != nil { - return fmt.Errorf("failed to open file to sign: %v", err) + return fmt.Errorf("failed to open file to sign: %w", err) } defer inFile.Close() diff --git a/options/run.go b/options/run.go index 4b0119e7..e17b9619 100644 --- a/options/run.go +++ b/options/run.go @@ -15,6 +15,7 @@ package options import ( + "fmt" "github.com/spf13/cobra" "github.com/testifysec/go-witness/attestation" "github.com/testifysec/go-witness/log" @@ -55,12 +56,14 @@ func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivist to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { - log.Debugf("failed to hide enable-archivist flag: %v", err) + err := fmt.Errorf("failed to hide enable-archivist flag: %v", err) + log.Debug(err) } cmd.Flags().StringVar(&o.Url, "archivista-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations") cmd.Flags().StringVar(&o.Url, "archivist-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("archivist-server"); err != nil { - log.Debugf("failed to hide archivist-server flag: %v", err) + err := fmt.Errorf("failed to hide archivist-server flag: %v", err) + log.Debug(err) } } From 88ce95155792f051a08c312275637ecdd3259f82 Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Wed, 29 Nov 2023 14:33:57 +0000 Subject: [PATCH 4/6] fixing formatting directive Signed-off-by: chaosinthecrd --- options/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/run.go b/options/run.go index e17b9619..172eb4c3 100644 --- a/options/run.go +++ b/options/run.go @@ -56,14 +56,14 @@ func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivist to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { - err := fmt.Errorf("failed to hide enable-archivist flag: %v", err) + err := fmt.Errorf("failed to hide enable-archivist flag: %w", err) log.Debug(err) } cmd.Flags().StringVar(&o.Url, "archivista-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations") cmd.Flags().StringVar(&o.Url, "archivist-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("archivist-server"); err != nil { - err := fmt.Errorf("failed to hide archivist-server flag: %v", err) + err := fmt.Errorf("failed to hide archivist-server flag: %w", err) log.Debug(err) } } From c467d786b0e38db3d4704b6ad475f6c34a3ae29f Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Wed, 29 Nov 2023 15:14:11 +0000 Subject: [PATCH 5/6] caught a couple of missing archivist -> archivista changes Signed-off-by: chaosinthecrd --- cmd/run.go | 4 ++-- options/run.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index 98ccb8ac..efcea5b2 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -127,9 +127,9 @@ func runRun(ctx context.Context, ro options.RunOptions, args []string, signers . if ro.ArchivistaOptions.Enable { archivistaClient := archivista.New(ro.ArchivistaOptions.Url) if gitoid, err := archivistaClient.Store(ctx, result.SignedEnvelope); err != nil { - return fmt.Errorf("failed to store artifact in archivist: %w", err) + return fmt.Errorf("failed to store artifact in archivista: %w", err) } else { - log.Infof("Stored in archivist as %v\n", gitoid) + log.Infof("Stored in archivista as %v\n", gitoid) } } diff --git a/options/run.go b/options/run.go index 172eb4c3..95f214c3 100644 --- a/options/run.go +++ b/options/run.go @@ -54,7 +54,7 @@ type ArchivistaOptions struct { func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") - cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivist to store or retrieve attestations (deprecated)") + cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivista to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { err := fmt.Errorf("failed to hide enable-archivist flag: %w", err) log.Debug(err) From 501481679d3beb87cdba99f105531ce0b016c00f Mon Sep 17 00:00:00 2001 From: chaosinthecrd Date: Tue, 5 Dec 2023 12:16:15 +0000 Subject: [PATCH 6/6] making changes after updating go-witness logging interface Signed-off-by: chaosinthecrd --- cmd/config.go | 6 ++---- cmd/keyloader.go | 6 ++---- go.mod | 12 ++++++------ go.sum | 28 ++++++++++++++-------------- options/run.go | 7 ++----- 5 files changed, 26 insertions(+), 33 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index 6be94be2..430c1813 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -64,16 +64,14 @@ func initConfig(rootCmd *cobra.Command, rootOptions *options.RootOptions) error if len(configValue) > 0 { configValueStr := strings.Join(configValue, ",") if err := flags.Set(f.Name, configValueStr); err != nil { - err := fmt.Errorf("failed to set config value: %w", err) - log.Error(err) + log.Errorf("failed to set config value: %w", err) } } } else { configValue := v.GetString(configKey) if configValue != "" { if err := flags.Set(f.Name, configValue); err != nil { - err := fmt.Errorf("failed to set config value: %w", err) - log.Error(err) + log.Errorf("failed to set config value: %w", err) } } } diff --git a/cmd/keyloader.go b/cmd/keyloader.go index be70b637..467c3a8f 100644 --- a/cmd/keyloader.go +++ b/cmd/keyloader.go @@ -52,15 +52,13 @@ func loadSigners(ctx context.Context, so options.SignerOptions, signerProviders setters := so[signerProvider] sp, err := signer.NewSignerProvider(signerProvider, setters...) if err != nil { - err := fmt.Errorf("failed to create %v signer provider: %w", signerProvider, err) - log.Error(err) + log.Errorf("failed to create %v signer provider: %w", signerProvider, err) continue } s, err := sp.Signer(ctx) if err != nil { - err := fmt.Errorf("failed to create %v signer: %w", signerProvider, err) - log.Error(err) + log.Errorf("failed to create %v signer: %w", signerProvider, err) continue } diff --git a/go.mod b/go.mod index 498c8e46..a54dcaaa 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/segmentio/ksuid v1.0.4 // indirect github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect - github.com/spiffe/go-spiffe/v2 v2.1.2 // indirect + github.com/spiffe/go-spiffe/v2 v2.1.6 // indirect github.com/zclconf/go-cty v1.12.1 // indirect golang.org/x/oauth2 v0.7.0 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -30,7 +30,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect github.com/acomagu/bufpipe v1.0.3 // indirect github.com/agnivade/levenshtein v1.1.1 // indirect - github.com/aws/aws-sdk-go v1.44.207 // indirect + github.com/aws/aws-sdk-go v1.44.334 // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -55,9 +55,9 @@ require ( github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf // indirect github.com/magiconair/properties v1.8.7 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/open-policy-agent/opa v0.49.1 // indirect + github.com/open-policy-agent/opa v0.49.2 // indirect github.com/owenrumney/go-sarif v1.1.1 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect @@ -66,7 +66,7 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/sigstore/fulcio v1.1.0 // indirect - github.com/sigstore/sigstore v1.5.1 // indirect + github.com/sigstore/sigstore v1.5.2 // indirect github.com/skeema/knownhosts v1.1.0 // indirect github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect @@ -90,7 +90,7 @@ require ( golang.org/x/tools v0.6.0 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.56.3 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 086d61fb..0479a084 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go v1.44.207 h1:7O0AMKxTm+/GUx6zw+3dqc+fD3tTzv8xaZPYo+ywRwE= -github.com/aws/aws-sdk-go v1.44.207/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.334 h1:h2bdbGb//fez6Sv6PaYv868s9liDeoYM6hYsAqTB4MU= +github.com/aws/aws-sdk-go v1.44.334/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= @@ -133,7 +133,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= -github.com/go-rod/rod v0.112.3 h1:xbSaA9trZ8v/+eJRGOM6exK1RCsLPwwnzA78vpES0gk= +github.com/go-rod/rod v0.112.6 h1:zMirUmhsBeshMWyf285BD0UGtGq54HfThLDGSjcP3lU= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= @@ -249,15 +249,15 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/open-policy-agent/opa v0.49.1 h1:hXnKOmzVk8TyCTHEoHTZvYjAqwOBS9n+3mf4zmdDtP0= -github.com/open-policy-agent/opa v0.49.1/go.mod h1:Wvc+vpbXuYxhKk0uvhTxmDmZ3rjSXtqYJBtGAPNoJ6E= +github.com/open-policy-agent/opa v0.49.2 h1:n8ntRq/yDWy+cmYaqSLrHXmrT3tX8WlK28vjFQdC6W8= +github.com/open-policy-agent/opa v0.49.2/go.mod h1:7L3lN5qe8xboRmEHxC5lGjo5KsRMdK+CCLiFoOCP7rU= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/owenrumney/go-sarif v1.1.1 h1:QNObu6YX1igyFKhdzd7vgzmw7XsWN3/6NMGuDzBgXmE= @@ -289,8 +289,8 @@ github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= github.com/sigstore/fulcio v1.1.0 h1:mzzJ05Ccu8Y2inyioklNvc8MpzlGHxu8YqNeTm0dHfU= github.com/sigstore/fulcio v1.1.0/go.mod h1:zv1ZQTXZbUwQdRwajlQksc34pRas+2aZYpIZoQBNev8= -github.com/sigstore/sigstore v1.5.1 h1:iUou0QJW8eQKMUkTXbFyof9ZOblDtfaW2Sn2+QI8Tcs= -github.com/sigstore/sigstore v1.5.1/go.mod h1:3i6UTWVNtFwOtbgG63FZZNID4vO9KcO8AszIJlaNI8k= +github.com/sigstore/sigstore v1.5.2 h1:rvZSPJDH2ysoc8kjW9v4nv1UX3XwSA8y4x6Dk7hA0D4= +github.com/sigstore/sigstore v1.5.2/go.mod h1:wxhp9KoaOpeb1VLKILruD283KJqPSqX+3TuBByVDZ6E= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= @@ -310,8 +310,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= -github.com/spiffe/go-spiffe/v2 v2.1.2 h1:nfNwopOP7q0qsWU6AUASqmbtYViwHA6vuHyAtqFJtNc= -github.com/spiffe/go-spiffe/v2 v2.1.2/go.mod h1:cbQmFrxsOpbm5tWURAYip9ZK0dOSFeoFG3/5Ub9Hvy0= +github.com/spiffe/go-spiffe/v2 v2.1.6 h1:4SdizuQieFyL9eNU+SPiCArH4kynzaKOOj0VvM8R7Xo= +github.com/spiffe/go-spiffe/v2 v2.1.6/go.mod h1:eVDqm9xFvyqao6C+eQensb9ZPkyNEeaUbqbBpOhBnNk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -529,12 +529,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -711,8 +711,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVCwMc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/options/run.go b/options/run.go index 95f214c3..d8bc8a3c 100644 --- a/options/run.go +++ b/options/run.go @@ -15,7 +15,6 @@ package options import ( - "fmt" "github.com/spf13/cobra" "github.com/testifysec/go-witness/attestation" "github.com/testifysec/go-witness/log" @@ -56,14 +55,12 @@ func (o *ArchivistaOptions) AddFlags(cmd *cobra.Command) { cmd.Flags().BoolVar(&o.Enable, "enable-archivista", false, "Use Archivista to store or retrieve attestations") cmd.Flags().BoolVar(&o.Enable, "enable-archivist", false, "Use Archivista to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("enable-archivist"); err != nil { - err := fmt.Errorf("failed to hide enable-archivist flag: %w", err) - log.Debug(err) + log.Errorf("failed to hide enable-archivist flag: %w", err) } cmd.Flags().StringVar(&o.Url, "archivista-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations") cmd.Flags().StringVar(&o.Url, "archivist-server", "https://archivista.testifysec.io", "URL of the Archivista server to store or retrieve attestations (deprecated)") if err := cmd.Flags().MarkHidden("archivist-server"); err != nil { - err := fmt.Errorf("failed to hide archivist-server flag: %w", err) - log.Debug(err) + log.Debugf("failed to hide archivist-server flag: %w", err) } }