mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Add warning if shell expansion characters make it in to the path (#5001)
This commit is contained in:
@@ -42,6 +42,10 @@ func NewKeystore(input string) (KeyManager, string, error) {
|
||||
return nil, keystoreOptsHelp, err
|
||||
}
|
||||
|
||||
if strings.Contains(opts.Path, "$") || strings.Contains(opts.Path, "~") || strings.Contains(opts.Path, "%") {
|
||||
log.WithField("path", opts.Path).Warn("Keystore path contains unexpanded shell expansion characters")
|
||||
}
|
||||
|
||||
if opts.Path == "" {
|
||||
opts.Path = defaultValidatorDir()
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
@@ -35,6 +36,10 @@ func NewUnencrypted(input string) (*Unencrypted, string, error) {
|
||||
return nil, unencryptedOptsHelp, err
|
||||
}
|
||||
|
||||
if strings.Contains(opts.Path, "$") || strings.Contains(opts.Path, "~") || strings.Contains(opts.Path, "%") {
|
||||
log.WithField("path", opts.Path).Warn("Keystore path contains unexpanded shell expansion characters")
|
||||
}
|
||||
|
||||
path, err := filepath.Abs(opts.Path)
|
||||
if err != nil {
|
||||
return nil, unencryptedOptsHelp, err
|
||||
|
||||
@@ -60,6 +60,9 @@ func NewWallet(input string) (KeyManager, string, error) {
|
||||
accounts: make(map[[48]byte]e2wtypes.Account),
|
||||
}
|
||||
|
||||
if strings.Contains(opts.Location, "$") || strings.Contains(opts.Location, "~") || strings.Contains(opts.Location, "%") {
|
||||
log.WithField("path", opts.Location).Warn("Keystore path contains unexpanded shell expansion characters")
|
||||
}
|
||||
var store e2wtypes.Store
|
||||
if opts.Location == "" {
|
||||
store = filesystem.New()
|
||||
|
||||
Reference in New Issue
Block a user