Skip to content

Commit

Permalink
Fix: don't log tor control port password
Browse files Browse the repository at this point in the history
Implement custom Debug impl that redacts the password
  • Loading branch information
sdbondi committed Jul 20, 2021
1 parent c4d4cae commit 03e679e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion common/src/configuration/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ use config::{Config, ConfigError, Environment};
use multiaddr::Multiaddr;
use std::{
convert::TryInto,
fmt,
fmt::Formatter,
net::SocketAddr,
num::{NonZeroU16, TryFromIntError},
path::PathBuf,
Expand Down Expand Up @@ -824,7 +826,7 @@ pub enum DatabaseType {
}

//--------------------------------------------- Network Transport ------------------------------------------//
#[derive(Debug, Clone)]
#[derive(Clone)]
pub enum TorControlAuthentication {
None,
Password(String),
Expand Down Expand Up @@ -861,6 +863,16 @@ impl FromStr for TorControlAuthentication {
}
}

impl fmt::Debug for TorControlAuthentication {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
use TorControlAuthentication::*;
match self {
None => write!(f, "None"),
Password(_) => write!(f, "Password(...)"),
}
}
}

#[derive(Debug, Clone)]
pub enum SocksAuthentication {
None,
Expand Down

0 comments on commit 03e679e

Please sign in to comment.