Skip to content

Commit

Permalink
Merge pull request #11693 from vegaprotocol/feature/add-tendermint-pu…
Browse files Browse the repository at this point in the history
…bkey-validation-on-import

feat: add validation when loading tendermint pubkey
  • Loading branch information
jeremyletang authored Sep 17, 2024
2 parents 913fb42 + ed09c32 commit 605bb60
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 605bb60

Please sign in to comment.