Skip to content

Commit

Permalink
feat: add validation when loading tendermint pubkey
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Letang <[email protected]>
  • Loading branch information
jeremyletang committed Sep 17, 2024
1 parent 913fb42 commit ed09c32
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/vega/commands/nodewallet/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package nodewallet

import (
"encoding/base64"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -137,6 +138,12 @@ func (opts *importCmd) Execute(_ []string) error {
}
}

// validate the key is base64
_, err := base64.StdEncoding.DecodeString(tendermintPubkey)
if err != nil {
return fmt.Errorf("tendermint pubkey must be base64 encoded: %w", err)
}

data, err = nodewallets.ImportTendermintPubkey(vegaPaths, registryPass, tendermintPubkey, opts.Force)
if err != nil {
return fmt.Errorf("couldn't import Tendermint pubkey: %w", err)
Expand Down

0 comments on commit ed09c32

Please sign in to comment.