fix(auth): harden Windows auth store privacy

This commit is contained in:
2026-08-16 18:44:38 +02:00
parent f6e4dbcae2
commit 25ee8b87d1
8 changed files with 556 additions and 31 deletions
+4
View File
@@ -77,6 +77,10 @@ func WriteCanonicalNewFile(path string, contents []byte, mode os.FileMode) error
return ErrUnsafeFile
}
defer file.Close()
if err := ProtectPrivateRegular(path); err != nil {
_ = os.Remove(path)
return ErrUnsafeFile
}
if _, err := file.Write(contents); err != nil {
_ = os.Remove(path)
return ErrUnsafeFile