Skip to content

Commit 830bcfa

Browse files
committed
filesystem: make WriteFile file permissions more restrictive
Currently, the only usage of 'WriteFile()' is in the daemon providers, used to write out their respective daemon configurations. The permissions '644' were selected somewhat arbitrarily (corresponding to Git's "non-executable" file mode). However, all other file writing in the repository uses the permissions '600' (removing read permissions for group & all). The daemon configuration files do not actually need more than that, so change 'WriteFile()'s permissions to '600'. In addition to internal consistency, this sets us up to more easily use 'common.FileSystem' for file writing across the repository. Signed-off-by: Victoria Dye <[email protected]>
1 parent c3beec2 commit 830bcfa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/common/filesystem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (f *fileSystem) WriteFile(filename string, content []byte) error {
4141
return fmt.Errorf("error creating parent directories: %w", err)
4242
}
4343

44-
err = os.WriteFile(filename, content, 0o644)
44+
err = os.WriteFile(filename, content, 0o600)
4545
if err != nil {
4646
return fmt.Errorf("could not write file: %w", err)
4747
}

0 commit comments

Comments
 (0)