Skip to content

Commit 5f5781e

Browse files
committed
fix: reduce permissions of nix.conf to 0600
Since the file now holds some tokens, make it non-world readable.
1 parent 5332bac commit 5f5781e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/config/nixconf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (n *NixConfig) readConfigLines() ([]string, error) {
198198
}
199199

200200
func (n *NixConfig) writeConfigLines(lines []string) error {
201-
file, err := os.OpenFile(n.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
201+
file, err := os.OpenFile(n.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
202202
if err != nil {
203203
return fmt.Errorf("failed to open config file: %w", err)
204204
}
@@ -284,7 +284,7 @@ func (n *NixConfig) createBackup(backupPath string) error {
284284
if err != nil {
285285
return err
286286
}
287-
return os.WriteFile(backupPath, input, 0644)
287+
return os.WriteFile(backupPath, input, 0600)
288288
}
289289

290290
// expandTilde expands ~ to the user's home directory

0 commit comments

Comments
 (0)