Apply `sensitive` in some info-level log messages.

This specifically applies the `sensitive` wrapper in the places
where we're logging target addresses at level "info" or higher.
This commit is contained in:
Nick Mathewson 2022-05-02 19:44:12 -04:00
parent 7aacc6e30c
commit 4679023c39
6 changed files with 11 additions and 3 deletions

3
Cargo.lock generated
View File

@ -86,6 +86,7 @@ dependencies = [
"notify", "notify",
"once_cell", "once_cell",
"rlimit", "rlimit",
"safelog",
"serde", "serde",
"tokio", "tokio",
"tor-config", "tor-config",
@ -135,6 +136,7 @@ dependencies = [
"once_cell", "once_cell",
"pin-project", "pin-project",
"postage", "postage",
"safelog",
"serde", "serde",
"tempfile", "tempfile",
"thiserror", "thiserror",
@ -3374,6 +3376,7 @@ dependencies = [
"pin-project", "pin-project",
"rand 0.8.5", "rand 0.8.5",
"retry-error", "retry-error",
"safelog",
"serde", "serde",
"static_assertions", "static_assertions",
"thiserror", "thiserror",

View File

@ -31,6 +31,7 @@ error_detail = []
experimental-api = [] experimental-api = []
[dependencies] [dependencies]
safelog = { path = "../safelog", version = "0.2.0" }
tor-basic-utils = { path = "../tor-basic-utils", version = "0.2.0" } tor-basic-utils = { path = "../tor-basic-utils", version = "0.2.0" }
tor-circmgr = { path = "../tor-circmgr", version = "0.2.0" } tor-circmgr = { path = "../tor-circmgr", version = "0.2.0" }
tor-config = { path = "../tor-config", version = "0.2.0" } tor-config = { path = "../tor-config", version = "0.2.0" }

View File

@ -7,6 +7,7 @@
use crate::address::IntoTorAddr; use crate::address::IntoTorAddr;
use crate::config::{ClientAddrConfig, StreamTimeoutConfig, TorClientConfig}; use crate::config::{ClientAddrConfig, StreamTimeoutConfig, TorClientConfig};
use safelog::sensitive;
use tor_circmgr::isolation::Isolation; use tor_circmgr::isolation::Isolation;
use tor_circmgr::{isolation::StreamIsolationBuilder, IsolationToken, TargetPort}; use tor_circmgr::{isolation::StreamIsolationBuilder, IsolationToken, TargetPort};
use tor_config::MutCfg; use tor_config::MutCfg;
@ -675,7 +676,7 @@ impl<R: Runtime> TorClient<R> {
.get_or_launch_exit_circ(&exit_ports, prefs) .get_or_launch_exit_circ(&exit_ports, prefs)
.await .await
.map_err(wrap_err)?; .map_err(wrap_err)?;
info!("Got a circuit for {}:{}", addr, port); info!("Got a circuit for {}:{}", sensitive(&addr), port);
let stream_future = circ.begin_stream(&addr, port, Some(prefs.stream_parameters())); let stream_future = circ.begin_stream(&addr, port, Some(prefs.stream_parameters()));
// This timeout is needless but harmless for optimistic streams. // This timeout is needless but harmless for optimistic streams.

View File

@ -23,6 +23,7 @@ static-native-tls = ["arti-client/static-native-tls", "native-tls"]
journald = ["tracing-journald"] journald = ["tracing-journald"]
[dependencies] [dependencies]
safelog = { path = "../safelog", version = "0.2.0" }
arti-client = { package = "arti-client", path = "../arti-client", version = "0.2.0", default-features = false } arti-client = { package = "arti-client", path = "../arti-client", version = "0.2.0", default-features = false }
tor-config = { path = "../tor-config", version = "0.2.0" } tor-config = { path = "../tor-config", version = "0.2.0" }
tor-error = { path = "../tor-error", version = "0.2.0", default-features = false } tor-error = { path = "../tor-error", version = "0.2.0", default-features = false }

View File

@ -7,6 +7,7 @@ use futures::future::FutureExt;
use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, Error as IoError}; use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, Error as IoError};
use futures::stream::StreamExt; use futures::stream::StreamExt;
use futures::task::SpawnExt; use futures::task::SpawnExt;
use safelog::sensitive;
use std::io::Result as IoResult; use std::io::Result as IoResult;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use tracing::{error, info, warn}; use tracing::{error, info, warn};
@ -162,7 +163,7 @@ See <a href="https://gitlab.torproject.org/tpo/core/arti/#todo-need-to-change-wh
info!( info!(
"Got a socks request: {} {}:{}", "Got a socks request: {} {}:{}",
request.command(), request.command(),
addr, sensitive(&addr),
port port
); );
@ -202,7 +203,7 @@ See <a href="https://gitlab.torproject.org/tpo/core/arti/#todo-need-to-change-wh
} }
}; };
// Okay, great! We have a connection over the Tor network. // Okay, great! We have a connection over the Tor network.
info!("Got a stream for {}:{}", addr, port); info!("Got a stream for {}:{}", sensitive(&addr), port);
// TODO: Should send a SOCKS reply if something fails. See #258. // TODO: Should send a SOCKS reply if something fails. See #258.
// Send back a SOCKS response, telling the client that it // Send back a SOCKS response, telling the client that it

View File

@ -19,6 +19,7 @@ repository = "https://gitlab.torproject.org/tpo/core/arti.git/"
experimental-api = [] experimental-api = []
[dependencies] [dependencies]
safelog = { path = "../safelog", version = "0.2.0" }
tor-basic-utils = { path = "../tor-basic-utils", version = "0.2.0" } tor-basic-utils = { path = "../tor-basic-utils", version = "0.2.0" }
tor-chanmgr = { path = "../tor-chanmgr", version = "0.2.0" } tor-chanmgr = { path = "../tor-chanmgr", version = "0.2.0" }
tor-config = { path = "../tor-config", version = "0.2.0" } tor-config = { path = "../tor-config", version = "0.2.0" }