From 98440d6183d0c5870416326fdcad3c0e8980fd66 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Fri, 17 Jan 2025 13:07:11 -0600 Subject: [PATCH] feat(doctor): display redacted github token (#4149) * feat(doctor): display redacted github token * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/cli/doctor/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cli/doctor/mod.rs b/src/cli/doctor/mod.rs index aac2fd2d44..743e3bfb4e 100644 --- a/src/cli/doctor/mod.rs +++ b/src/cli/doctor/mod.rs @@ -414,9 +414,17 @@ fn mise_dirs() -> Vec<(String, &'static Path)> { } fn mise_env_vars() -> Vec<(String, String)> { + const REDACT_KEYS: &[&str] = &["MISE_GITHUB_TOKEN"]; env::vars() .filter(|(k, _)| k.starts_with("MISE_")) - .filter(|(k, _)| k != "MISE_GITHUB_TOKEN") + .map(|(k, v)| { + let v = if REDACT_KEYS.contains(&k.as_str()) { + style::ndim("REDACTED").to_string() + } else { + v + }; + (k, v) + }) .collect() }