fix: purge keychain credentials on profile delete, atomic owner-only secret writes, zeroize derived keys

- Secrets::delete_profile removes every profile credential kind from the OS
  keychain as well as the vault (previously only the vault was purged, so
  keychain passwords/tokens outlived the profile).
- write_private writes to a sibling temp file and renames it into place, so a
  crash mid-write cannot truncate the vault or an export, and a pre-existing
  world-readable file is replaced rather than reused.
- Argon2-derived vault/export keys are Zeroizing and wiped on drop.
- Recordings (which capture typed input), JSON exports and --data-dir
  directories are created owner-only.
This commit is contained in:
Andy Dixon
2026-10-12 07:20:11 +01:00
parent 8766846a3b
commit 9cf221779b
8 changed files with 102 additions and 23 deletions
+2 -1
View File
@@ -51,7 +51,8 @@ impl AppConfig {
}
}
fn create_private_dir(d: &Path) -> std::io::Result<()> {
/// Creates `d` (and parents) readable only by the owner.
pub fn create_private_dir(d: &Path) -> std::io::Result<()> {
std::fs::create_dir_all(d)?;
#[cfg(unix)]
std::fs::set_permissions(d, std::os::unix::fs::PermissionsExt::from_mode(0o700))?;