mirror of
https://github.com/FiloSottile/age.git
synced 2026-03-11 08:55:41 +00:00
cmd/age-keygen: detect world-readable output file
This commit is contained in:
parent
93ea79628d
commit
0369d9b7fb
1 changed files with 7 additions and 0 deletions
|
|
@ -36,6 +36,13 @@ func main() {
|
|||
out = f
|
||||
}
|
||||
|
||||
if fi, err := out.Stat(); err == nil {
|
||||
if fi.Mode().IsRegular() && fi.Mode().Perm()&0004 != 0 {
|
||||
fmt.Fprintf(os.Stderr, "Warning: writing to a world-readable file.\n")
|
||||
fmt.Fprintf(os.Stderr, "Consider setting the umask to 066 and trying again.\n")
|
||||
}
|
||||
}
|
||||
|
||||
generate(out)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue