diff --git a/.golangci.yml b/.golangci.yml index 58bf167f26c..de823f35625 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -69,6 +69,7 @@ linters-settings: - G109 - G112 - G114 + - G302 run: timeout: 10m diff --git a/pkg/mimirtool/commands/config.go b/pkg/mimirtool/commands/config.go index d91c526481a..2dbd99f1941 100644 --- a/pkg/mimirtool/commands/config.go +++ b/pkg/mimirtool/commands/config.go @@ -107,7 +107,7 @@ func (c *ConfigCommand) output(yamlContents []byte, flags []string, notices conf if path == "" { return defaultWriter, func() {}, nil } - outWriter, err := os.OpenFile(path, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0666) + outWriter, err := os.OpenFile(path, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0600) if err != nil { return nil, nil, errors.Wrap(err, "could not open "+path) } diff --git a/pkg/util/activitytracker/activity_tracker.go b/pkg/util/activitytracker/activity_tracker.go index 745cc504030..01d8d9a7400 100644 --- a/pkg/util/activitytracker/activity_tracker.go +++ b/pkg/util/activitytracker/activity_tracker.go @@ -172,7 +172,7 @@ func trimEntryToSize(entry string, size int) string { } func getMappedFile(filename string, filesize int) (*os.File, mmap.MMap, error) { - file, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0666) + file, err := os.OpenFile(filename, os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0600) if err != nil { return nil, nil, errors.Wrap(err, "failed to create activity file") } diff --git a/pkg/util/shutdownmarker/shutdown_marker.go b/pkg/util/shutdownmarker/shutdown_marker.go index a07a64f5493..9eb83bfac45 100644 --- a/pkg/util/shutdownmarker/shutdown_marker.go +++ b/pkg/util/shutdownmarker/shutdown_marker.go @@ -29,7 +29,7 @@ func Remove(p string) error { return err } - dir, err := os.OpenFile(path.Dir(p), os.O_RDONLY, 0777) + dir, err := os.OpenFile(path.Dir(p), os.O_RDONLY, 0600) // mode doesn't matter since we're not passing os.O_CREATE if err != nil { return err }