diff --git a/cli/internal/cmd/verify.go b/cli/internal/cmd/verify.go index 3f10ad7762..fd0eb00cdb 100644 --- a/cli/internal/cmd/verify.go +++ b/cli/internal/cmd/verify.go @@ -59,7 +59,7 @@ func NewVerifyCmd() *cobra.Command { } cmd.Flags().String("cluster-id", "", "expected cluster identifier") cmd.Flags().Bool("raw", false, "print raw attestation document") - cmd.Flags().String("output", "", "print the attestation document in the output format {json}") + cmd.Flags().StringP("output", "o", "", "print the attestation document in the output format {json}") cmd.Flags().StringP("node-endpoint", "e", "", "endpoint of the node to verify, passed as HOST[:PORT]") return cmd } @@ -155,7 +155,7 @@ func (c *verifyCmd) verify(cmd *cobra.Command, fileHandler file.Handler, verifyC return fmt.Errorf("printing attestation document: %w", err) } cmd.Println(attDocOutput) - cmd.Println("Verification OK") + cmd.PrintErrln("Verification OK") return nil } @@ -217,11 +217,11 @@ func (c *verifyCmd) parseVerifyFlags(cmd *cobra.Command, fileHandler file.Handle if emptyEndpoint || emptyIDs { c.log.Debugf("Trying to supplement empty flag values from %q", pf.PrefixPrintablePath(constants.ClusterIDsFilename)) if emptyEndpoint { - cmd.Printf("Using endpoint from %q. Specify --node-endpoint to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename)) + cmd.PrintErrf("Using endpoint from %q. Specify --node-endpoint to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename)) endpoint = idFile.IP } if emptyIDs { - cmd.Printf("Using ID from %q. Specify --cluster-id to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename)) + cmd.PrintErrf("Using ID from %q. Specify --cluster-id to override this.\n", pf.PrefixPrintablePath(constants.ClusterIDsFilename)) ownerID = idFile.OwnerID clusterID = idFile.ClusterID } diff --git a/cli/internal/cmd/verify_test.go b/cli/internal/cmd/verify_test.go index 37ff14a4c4..c9d53bdea2 100644 --- a/cli/internal/cmd/verify_test.go +++ b/cli/internal/cmd/verify_test.go @@ -167,8 +167,7 @@ func TestVerify(t *testing.T) { cmd.Flags().String("workspace", "", "") // register persistent flag manually cmd.Flags().Bool("force", true, "") // register persistent flag manually out := &bytes.Buffer{} - cmd.SetOut(out) - cmd.SetErr(&bytes.Buffer{}) + cmd.SetErr(out) if tc.clusterIDFlag != "" { require.NoError(cmd.Flags().Set("cluster-id", tc.clusterIDFlag)) } diff --git a/docs/docs/reference/cli.md b/docs/docs/reference/cli.md index fb10b1c8e6..292aa11664 100644 --- a/docs/docs/reference/cli.md +++ b/docs/docs/reference/cli.md @@ -391,8 +391,8 @@ constellation verify [flags] ``` --cluster-id string expected cluster identifier -h, --help help for verify - --json print the attestation document as parsed json -e, --node-endpoint string endpoint of the node to verify, passed as HOST[:PORT] + -o, --output string print the attestation document in the output format {json} --raw print raw attestation document ``` diff --git a/internal/verify/verify.go b/internal/verify/verify.go index 28f0133a76..7371325e98 100644 --- a/internal/verify/verify.go +++ b/internal/verify/verify.go @@ -38,15 +38,16 @@ type Certificate struct { // TCBVersion contains the TCB version data. type TCBVersion struct { - Bootloader uint8 - TEE uint8 - SNP uint8 - Microcode uint8 - Spl4 uint8 - Spl5 uint8 - Spl6 uint8 - Spl7 uint8 - UcodeSpl uint8 // UcodeSpl is the microcode security patch level. + Bootloader uint8 `json:"bootloader"` + TEE uint8 `json:"tee"` + SNP uint8 `json:"snp"` + Microcode uint8 `json:"microcode"` + Spl4 uint8 `json:"spl4"` + Spl5 uint8 `json:"spl5"` + Spl6 uint8 `json:"spl6"` + Spl7 uint8 `json:"spl7"` + // UcodeSpl is the microcode security patch level. + UcodeSpl uint8 `json:"ucode_spl"` } // PlatformInfo contains the platform information.