Skip to content

Commit aac8970

Browse files
committed
Merge pull request #11693 from vegaprotocol/feature/add-tendermint-pubkey-validation-on-import
feat: add validation when loading tendermint pubkey
1 parent fe7ad56 commit aac8970

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cmd/vega/commands/nodewallet/import.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package nodewallet
1717

1818
import (
19+
"encoding/base64"
1920
"encoding/json"
2021
"errors"
2122
"fmt"
@@ -137,6 +138,12 @@ func (opts *importCmd) Execute(_ []string) error {
137138
}
138139
}
139140

141+
// validate the key is base64
142+
_, err := base64.StdEncoding.DecodeString(tendermintPubkey)
143+
if err != nil {
144+
return fmt.Errorf("tendermint pubkey must be base64 encoded: %w", err)
145+
}
146+
140147
data, err = nodewallets.ImportTendermintPubkey(vegaPaths, registryPass, tendermintPubkey, opts.Force)
141148
if err != nil {
142149
return fmt.Errorf("couldn't import Tendermint pubkey: %w", err)

0 commit comments

Comments
 (0)