Skip to content

Commit

Permalink
fix: correct file or dir permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Mar 13, 2024
1 parent cf2f443 commit dee1a20
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/utils/vrf_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func LoadVRFKey(keyFilePath string) (*VRFKey, error) {

func InitializeVRFKey(config *cfg.Config) (vrfPubKey sdkcrypto.PubKey, err error) {
pvKeyFile := config.PrivValidatorKeyFile()
if err := os.MkdirAll(filepath.Dir(pvKeyFile), 0o600); err != nil {
if err := os.MkdirAll(filepath.Dir(pvKeyFile), 0o700); err != nil {
return nil, fmt.Errorf("could not create directory %q: %w", filepath.Dir(pvKeyFile), err)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/sedad/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func readInMnemonic(cmd *cobra.Command) (string, error) {

func configureValidatorFiles(config *cfg.Config) error {
keyFilePath := config.PrivValidatorKeyFile()
if err := os.MkdirAll(filepath.Dir(keyFilePath), 0o600); err != nil {
if err := os.MkdirAll(filepath.Dir(keyFilePath), 0o700); err != nil {
return fmt.Errorf("could not create directory %q: %w", filepath.Dir(keyFilePath), err)
}
stateFilePath := config.PrivValidatorStateFile()
if err := os.MkdirAll(filepath.Dir(stateFilePath), 0o600); err != nil {
if err := os.MkdirAll(filepath.Dir(stateFilePath), 0o700); err != nil {
return fmt.Errorf("could not create directory %q: %w", filepath.Dir(stateFilePath), err)
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func writeFile(path string, body []byte) error {
return err
}

return os.WriteFile(path, body, 0o600)
return os.WriteFile(path, body, 0o700)
}

func decodeTx(txBytes []byte) (*sdktx.Tx, error) {
Expand Down
6 changes: 3 additions & 3 deletions e2e/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (v *validator) configDir() string {

func (v *validator) createConfig() error {
p := path.Join(v.configDir(), "config")
return os.MkdirAll(p, 0o600)
return os.MkdirAll(p, 0o700)
}

func (v *validator) init() error {
Expand Down Expand Up @@ -117,12 +117,12 @@ func (v *validator) createConsensusKey() error {
config.Moniker = v.moniker

pvKeyFile := config.PrivValidatorKeyFile()
if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0o600); err != nil {
if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0o700); err != nil {
return err
}

pvStateFile := config.PrivValidatorStateFile()
if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0o600); err != nil {
if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0o700); err != nil {
return err
}

Expand Down

0 comments on commit dee1a20

Please sign in to comment.