From 055b5f4d6eab9ff1a45742bef40d9289452010a7 Mon Sep 17 00:00:00 2001 From: Tori Date: Mon, 20 Jul 2026 19:39:53 -0500 Subject: [PATCH] fix(restore-session): scrub Nostr keys from log lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit master_key/trade_key were logged verbatim in 3 tracing calls, violating AGENTS.md's "scrub logs that might leak invoices or Nostr keys" guideline. master_key in particular is the user's persistent Nostr identity, not a per-trade ephemeral key — if these info/warn logs reach an external aggregator, anyone with log access could correlate "this identity restored a session at this timestamp" in cleartext. Closes #834 --- src/app/restore_session.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/restore_session.rs b/src/app/restore_session.rs index 0c47350a..7edb7126 100644 --- a/src/app/restore_session.rs +++ b/src/app/restore_session.rs @@ -26,10 +26,10 @@ pub async fn restore_session_action( return Err(MostroCantDo(CantDoReason::InvalidPubkey)); } - tracing::info!( - "Starting background restore session for master key: {}", - master_key - ); + // No key in the log line — master_key is the user's persistent Nostr + // identity, not a per-trade ephemeral one (AGENTS.md: scrub Nostr keys + // from logs). + tracing::info!("Starting background restore session"); // Create a new manager for this specific restore session let manager = RestoreSessionManager::new(); @@ -99,7 +99,8 @@ async fn send_restore_session_response( ) .await; - tracing::info!("Restore session response sent to user {}", trade_key,); + // No key in the log line (AGENTS.md: scrub Nostr keys from logs). + tracing::info!("Restore session response sent to user"); Ok(()) } @@ -112,7 +113,8 @@ async fn send_restore_session_timeout(trade_key: &str) -> Result<(), MostroError // Send timeout message without payload since Text doesn't exist enqueue_restore_session_msg(None, trade_pubkey).await; - tracing::warn!("Restore session timed out for user: {}", trade_key); + // No key in the log line (AGENTS.md: scrub Nostr keys from logs). + tracing::warn!("Restore session timed out for user"); Ok(()) }