Problem
If identity.age has weak permissions (world-readable), we should fail fast with clear error.
Pattern from Go CLI Books
Security best practice from both CLI books:
func validateKeyPermissions(path string) error {
info, err := os.Stat(path)
if err != nil {
return err
}
mode := info.Mode().Perm()
if mode&0077 != 0 {
return fmt.Errorf(
"key file %s has insecure permissions %o\n"+
"Expected 0600 (owner read/write only)\n"+
"Fix with: chmod 600 %s",
path, mode, path,
)
}
return nil
}
Action Items
Book References
- Search:
pdf-brain search "file permission security" --fts --expand 2000
- Search:
pdf-brain search "chmod 600 credential" --fts --expand 2000
Priority
P3 - Security hardening
Problem
If identity.age has weak permissions (world-readable), we should fail fast with clear error.
Pattern from Go CLI Books
Security best practice from both CLI books:
Action Items
internal/store/store.goon load--skip-permission-checkflag for edge casesBook References
pdf-brain search "file permission security" --fts --expand 2000pdf-brain search "chmod 600 credential" --fts --expand 2000Priority
P3 - Security hardening