mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Add SensitiveUrl to redact user secrets from endpoints (#2326)
## Issue Addressed #2276 ## Proposed Changes Add the `SensitiveUrl` struct which wraps `Url` and implements custom `Display` and `Debug` traits to redact user secrets from being logged in eth1 endpoints, beacon node endpoints and metrics. ## Additional Info This also includes a small rewrite of the eth1 crate to make requests using `Url` instead of `&str`. Some error messages have also been changed to remove `Url` data.
This commit is contained in:
@@ -18,3 +18,4 @@ genesis = { path = "../../beacon_node/genesis" }
|
||||
eth2 = { path = "../../common/eth2" }
|
||||
validator_client = { path = "../../validator_client" }
|
||||
validator_dir = { path = "../../common/validator_dir", features = ["insecure_keys"] }
|
||||
sensitive_url = { path = "../../common/sensitive_url" }
|
||||
|
||||
@@ -4,10 +4,8 @@
|
||||
|
||||
use beacon_node::ProductionBeaconNode;
|
||||
use environment::RuntimeContext;
|
||||
use eth2::{
|
||||
reqwest::{ClientBuilder, Url},
|
||||
BeaconNodeHttpClient,
|
||||
};
|
||||
use eth2::{reqwest::ClientBuilder, BeaconNodeHttpClient};
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
@@ -68,9 +66,10 @@ impl<E: EthSpec> LocalBeaconNode<E> {
|
||||
.http_api_listen_addr()
|
||||
.ok_or("A remote beacon node must have a http server")?;
|
||||
|
||||
let beacon_node_url: Url = format!("http://{}:{}", listen_addr.ip(), listen_addr.port())
|
||||
.parse()
|
||||
.map_err(|e| format!("Unable to parse beacon node URL: {:?}", e))?;
|
||||
let beacon_node_url: SensitiveUrl = SensitiveUrl::parse(
|
||||
format!("http://{}:{}", listen_addr.ip(), listen_addr.port()).as_str(),
|
||||
)
|
||||
.map_err(|e| format!("Unable to parse beacon node URL: {:?}", e))?;
|
||||
let beacon_node_http_client = ClientBuilder::new()
|
||||
.timeout(HTTP_TIMEOUT)
|
||||
.build()
|
||||
|
||||
Reference in New Issue
Block a user