From ae53f5651e22ee923dd578e5e6e2edcc5374470e Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Wed, 25 Feb 2026 10:18:42 -0500 Subject: [PATCH] Redact environment variables from debugger errors (#50008) Closes #50007 - Follow-up to: https://github.com/zed-industries/zed/pull/44783 Release Notes: - Improved redaction of sensitive environment variables from debugger error logs. --- crates/debugger_ui/src/debugger_panel.rs | 6 ++++-- crates/util/src/process.rs | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index d0b744bfe793ea31367cc48178903190a9becf59..cac96918e32cde4770bedac69fb92a08825e3b25 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -35,6 +35,7 @@ use tree_sitter::{Query, StreamingIterator as _}; use ui::{ ContextMenu, Divider, PopoverMenu, PopoverMenuHandle, SplitButton, Tab, Tooltip, prelude::*, }; +use util::redact::redact_command; use util::rel_path::RelPath; use util::{ResultExt, debug_panic, maybe}; use workspace::SplitDirection; @@ -275,12 +276,13 @@ impl DebugPanel { async move |_, cx| { if let Err(error) = task.await { - log::error!("{error:#}"); + let redacted_error = redact_command(&format!("{error:#}")); + log::error!("{redacted_error}"); session .update(cx, |session, cx| { session .console_output(cx) - .unbounded_send(format!("error: {:#}", error)) + .unbounded_send(format!("error: {:#}", redacted_error)) .ok(); session.shutdown(cx) }) diff --git a/crates/util/src/process.rs b/crates/util/src/process.rs index 6c3d4e0c41eaeabf4e0d485e4d70dd340ae7afc9..eaf543dbd817ba9b30e42eb17b7115aec39d44c9 100644 --- a/crates/util/src/process.rs +++ b/crates/util/src/process.rs @@ -36,7 +36,12 @@ impl Child { .stdout(stdout) .stderr(stderr) .spawn() - .with_context(|| format!("failed to spawn command {command:?}"))?; + .with_context(|| { + format!( + "failed to spawn command {}", + crate::redact::redact_command(&format!("{command:?}")) + ) + })?; Ok(Self { process }) } @@ -55,7 +60,12 @@ impl Child { .stdout(stdout) .stderr(stderr) .spawn() - .with_context(|| format!("failed to spawn command {command:?}"))?; + .with_context(|| { + format!( + "failed to spawn command {}", + crate::redact::redact_command(&format!("{command:?}")) + ) + })?; Ok(Self { process }) }