mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-07 04:26:20 +00:00
cmd/age-keygen: detect world-readable output file
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user