mirror of
https://github.com/Twigpine/zero.git
synced 2026-11-09 18:08:31 -10:00
When writing credentials or generating user secrets, files are written using a write-to-temp-then-rename pattern. However, neither package called Sync (fsync) on the temporary file before closing and renaming. If a crash or power failure occurred shortly after write, this could result in truncated or 0-byte key/credential files on disk. Add tmp.Sync() calls to writeNewSecretFile and Store.write to guarantee durability.