Skip to content

Commit

Permalink
cmd/clef: don't check file permissions on windows, closes #20123
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Jan 29, 2021
1 parent 7a800f9 commit 7e8976b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/clef/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,14 +805,16 @@ func readMasterKey(ctx *cli.Context, ui core.UIClientAPI) ([]byte, error) {

// checkFile is a convenience function to check if a file
// * exists
// * is mode 0400
// * is mode 0400 (unix only)
func checkFile(filename string) error {
info, err := os.Stat(filename)
if err != nil {
return fmt.Errorf("failed stat on %s: %v", filename, err)
}
// Check the unix permission bits
if info.Mode().Perm()&0377 != 0 {
// However, on windows, we cannot use the unix perm-bits, see
// https://github.com/ethereum/go-ethereum/issues/20123
if runtime.GOOS != "windows" && info.Mode().Perm()&0377 != 0 {
return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
}
return nil
Expand Down

0 comments on commit 7e8976b

Please sign in to comment.