Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

fix: truncate auth.json file before rewriting it (#1231)

Michael Bolin77b017f67dc3
diff --git a/codex-rs/login/src/lib.rs b/codex-rs/login/src/lib.rs
index 34c88f589c..390af74acc 100644
--- a/codex-rs/login/src/lib.rs
+++ b/codex-rs/login/src/lib.rs
@@ -75,7 +75,7 @@ pub async fn try_read_openai_api_key(codex_home: &Path) -> std::io::Result<Strin
auth_dot_json.last_refresh = Utc::now();
let mut options = OpenOptions::new();
- options.write(true).create(true);
+ options.truncate(true).write(true).create(true);
#[cfg(unix)]
{
options.mode(0o600);