Use default permissions of 0600 for crush.json to help protect sensitive

data that is stored in plain text (api keys, etc.)

Fixes #411
This commit is contained in:
Peter Sanchez
2025-07-31 15:04:09 -06:00
committed by Kujtim Hoxha
parent 3b8a8ef95c
commit c99034909d

View File

@@ -371,7 +371,7 @@ func (c *Config) SetConfigField(key string, value any) error {
if err != nil {
return fmt.Errorf("failed to set config field %s: %w", key, err)
}
if err := os.WriteFile(c.dataConfigDir, []byte(newValue), 0o644); err != nil {
if err := os.WriteFile(c.dataConfigDir, []byte(newValue), 0o600); err != nil {
return fmt.Errorf("failed to write config file: %w", err)
}
return nil