Skip to content

Commit

Permalink
feat(doctor): display redacted github token (#4149)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jdx and autofix-ci[bot] authored Jan 17, 2025
1 parent f1dec69 commit 98440d6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cli/doctor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit 98440d6

Please sign in to comment.