mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 21:07:43 +00:00
fix: remove plaintext credential logging (#1619)
This commit is contained in:
@@ -168,18 +168,18 @@ impl std::fmt::Debug for Opt {
|
||||
.field("address", &self.address)
|
||||
.field("server_domains", &self.server_domains)
|
||||
.field("access_key", &self.access_key)
|
||||
.field("secret_key", &Opt::mask_sensitive(Some(&self.secret_key))) // Hide sensitive values
|
||||
.field("secret_key", &rustfs_credentials::Masked(Some(&self.secret_key))) // Hide sensitive values
|
||||
.field("console_enable", &self.console_enable)
|
||||
.field("console_address", &self.console_address)
|
||||
.field("obs_endpoint", &self.obs_endpoint)
|
||||
.field("tls_path", &self.tls_path)
|
||||
.field("license", &Opt::mask_sensitive(self.license.as_ref()))
|
||||
.field("license", &rustfs_credentials::Masked(self.license.as_deref()))
|
||||
.field("region", &self.region)
|
||||
.field("kms_enable", &self.kms_enable)
|
||||
.field("kms_backend", &self.kms_backend)
|
||||
.field("kms_key_dir", &self.kms_key_dir)
|
||||
.field("kms_vault_address", &self.kms_vault_address)
|
||||
.field("kms_vault_token", &Opt::mask_sensitive(self.kms_vault_token.as_ref()))
|
||||
.field("kms_vault_token", &rustfs_credentials::Masked(self.kms_vault_token.as_deref()))
|
||||
.field("kms_default_key_id", &self.kms_default_key_id)
|
||||
.field("buffer_profile_disable", &self.buffer_profile_disable)
|
||||
.field("buffer_profile", &self.buffer_profile)
|
||||
@@ -187,16 +187,6 @@ impl std::fmt::Debug for Opt {
|
||||
}
|
||||
}
|
||||
|
||||
impl Opt {
|
||||
/// Mask sensitive information in Option<String>
|
||||
fn mask_sensitive(s: Option<&String>) -> String {
|
||||
match s {
|
||||
None => "".to_string(),
|
||||
Some(s) => format!("{}***{}|{}", s.chars().next().unwrap_or('*'), s.chars().last().unwrap_or('*'), s.len()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lazy_static::lazy_static! {
|
||||
// pub(crate) static ref OPT: OnceLock<Opt> = OnceLock::new();
|
||||
// }
|
||||
|
||||
+2
-2
@@ -168,8 +168,8 @@ async fn run(opt: config::Opt) -> Result<()> {
|
||||
info!(target: "rustfs::main::run", "Global action credentials initialized successfully.");
|
||||
}
|
||||
Err(e) => {
|
||||
let msg = format!("init_global_action_credentials failed: {e:?}");
|
||||
error!("{msg}");
|
||||
let msg = format!("init global action credentials failed: {e:?}");
|
||||
error!(target: "rustfs::main::run","{msg}");
|
||||
return Err(Error::other(msg));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user