Skip to content

Commit

Permalink
cli: don't try to download era config if --insecure flag is set (#721)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse authored Sep 9, 2024
1 parent 1b051da commit 564f99b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cli/internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 564f99b

Please sign in to comment.