Skip to content

Commit

Permalink
verify: verify active manifest at Coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
davidweisse committed Jun 24, 2024
1 parent afdc62e commit bdd53fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func runGenerate(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("failed to marshal manifest: %w", err)
}
if err := os.WriteFile(flags.manifestPath, manifestData, 0o644); err != nil {
if err := os.WriteFile(flags.manifestPath, append(manifestData, '\n'), 0o644); err != nil {
return fmt.Errorf("failed to write manifest: %w", err)
}

Expand Down
8 changes: 7 additions & 1 deletion cli/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cmd

import (
"bytes"
"crypto/sha256"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -96,7 +97,12 @@ func runVerify(cmd *cobra.Command, _ []string) error {
}
log.Debug("Got response")

fmt.Fprintln(cmd.OutOrStdout(), "✔️ Successfully verified coordinator")
currentManifest := resp.Manifests[len(resp.Manifests)-1]
if bytes.Equal(currentManifest, manifestBytes) {
fmt.Fprintln(cmd.OutOrStdout(), "✔️ Successfully verified coordinator")
} else {
fmt.Fprintln(cmd.OutOrStdout(), "❌Manifest at Coordinator does not match local manifest")
}

filelist := map[string][]byte{
coordRootPEMFilename: resp.RootCA,
Expand Down

0 comments on commit bdd53fb

Please sign in to comment.