From 564f99b36ee4e3bf27e1e61bf12db143d5df5d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= <66256922+daniel-weisse@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:22:15 +0200 Subject: [PATCH] cli: don't try to download era config if `--insecure` flag is set (#721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- cli/internal/cmd/cmd.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cli/internal/cmd/cmd.go b/cli/internal/cmd/cmd.go index fce49368..0a565d0c 100644 --- a/cli/internal/cmd/cmd.go +++ b/cli/internal/cmd/cmd.go @@ -59,7 +59,7 @@ func parseRestFlags(cmd *cobra.Command) (api.VerifyOptions, string, error) { return api.VerifyOptions{}, "", err } - if eraConfig == "" { + if eraConfig == "" && !insecure { eraConfig = eraDefaultConfig // reuse existing config from current working directory if none specified @@ -71,17 +71,19 @@ func parseRestFlags(cmd *cobra.Command) (api.VerifyOptions, string, error) { } } - verifyOptions, err := api.VerifyOptionsFromConfig(eraConfig) - if err != nil { - return api.VerifyOptions{}, "", fmt.Errorf("reading era config file: %w", err) - } - verifyOptions.AcceptedTCBStatuses = acceptedTCBStatuses - verifyOptions.Nonce = []byte(nonce) + var verifyOptions api.VerifyOptions if insecure { fmt.Fprintln(cmd.OutOrStdout(), "Warning: skipping quote verification") verifyOptions.InsecureSkipVerify = insecure + } else { + verifyOptions, err = api.VerifyOptionsFromConfig(eraConfig) + if err != nil { + return api.VerifyOptions{}, "", fmt.Errorf("reading era config file: %w", err) + } } + verifyOptions.AcceptedTCBStatuses = acceptedTCBStatuses + verifyOptions.Nonce = []byte(nonce) return verifyOptions, sgxQuotePath, nil }