Skip to content

Commit 13426b3

Browse files
fix: strict config file permissions
1 parent 9317a09 commit 13426b3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ func parseFileConfig(path string) (*Config, error) {
115115
return nil, fmt.Errorf("config: stat file: %w", err)
116116
}
117117

118-
if (fi.Mode().Perm() & 0o022) != 0 {
119-
logger.Warn("config file is writable by others", "path", path)
118+
if fi.Mode().Perm() != 0o600 {
119+
return nil, fmt.Errorf("config: %q has invalid permissions: got %04o, expected 0600", path, fi.Mode().Perm())
120120
}
121121

122122
raw, err := os.ReadFile(filepath.Clean(path))

0 commit comments

Comments
 (0)