diff --git a/pkg/config/config.go b/pkg/config/config.go index d480f8a74..1d4874b84 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -383,7 +383,7 @@ func checkFilePerms(files ...string) error { // Assume unix based system (MacOS and Linux) // the bit mask is calculated using the umask command which tells which permissions // should not be allowed for a particular user, group or world - if fInfo.Mode()&0o077 != 0 && runtime.GOOS != "windows" { + if fInfo.Mode()&0o033 != 0 && runtime.GOOS != "windows" { return errors.E(op, f+" should have at most rwx,-, - (bit mask 077) as permission") } } diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 95720c2f0..58ce8c9c5 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -409,7 +409,7 @@ func Test_checkFilePerms(t *testing.T) { t.Skipf("Chmod is not supported in windows, so not possible to test. Ref: https://github.com/golang/go/blob/master/src/os/os_test.go#L1031\n") } - incorrectPerms := []os.FileMode{0777, 0610, 0660} + incorrectPerms := []os.FileMode{0o777, 0o610, 0o660} var incorrectFiles = make([]string, len(incorrectPerms)) for i := range incorrectPerms { @@ -421,7 +421,7 @@ func Test_checkFilePerms(t *testing.T) { defer os.Remove(f) } - correctPerms := []os.FileMode{0600, 0400} + correctPerms := []os.FileMode{0o600, 0o400, 0o644} var correctFiles = make([]string, len(correctPerms)) for i := range correctPerms { @@ -441,8 +441,8 @@ func Test_checkFilePerms(t *testing.T) { tests := []test{ { - "should not have an error on 0600, 0400, 0640", - []string{correctFiles[0], correctFiles[1]}, + "should not have an error on 0600, 0400, 0644", + []string{correctFiles[0], correctFiles[1], correctFiles[2]}, false, }, {