Skip to content

Commit c212244

Browse files
committed
Display an error if .scwrc is too much open
1 parent 476dc39 commit c212244

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cli.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,16 @@ func getConfig() (*Config, error) {
360360
if err != nil {
361361
return nil, err
362362
}
363+
364+
stat, err := os.Stat(scwrc_path)
365+
// we don't care if it fails, the user just won't see the warning
366+
if err == nil {
367+
mode := stat.Mode()
368+
if mode&0066 != 0 {
369+
log.Fatalf("Permissions %#o for .scwrc are too open.", mode)
370+
}
371+
}
372+
363373
file, err := ioutil.ReadFile(scwrc_path)
364374
if err != nil {
365375
return nil, err

0 commit comments

Comments
 (0)