Skip to content

Commit

Permalink
chore: moved redact code to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
j4m1ef0rd committed Sep 11, 2023
1 parent a9a25eb commit d21c68f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ lazy_static = "1.4"
num-bigint = "0.4"
num-derive = "0.4"
num-traits = "0.2"
regex = "1"
secp256k1 = "0.27"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
Expand Down
1 change: 0 additions & 1 deletion engine/src/eth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod event;
pub mod redact_endpoint_secret;
pub mod retry_rpc;
pub mod rpc;

Expand Down
4 changes: 4 additions & 0 deletions utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ scopeguard = { version = "1.2.0" }
jsonrpsee = { version = "0.20", features = [
"jsonrpsee-types",
], optional = true }
regex = { version = "1", optional = true }
url = { version = "2.4", optional = true }

[dev-dependencies]
tempfile = "3.7.0"
Expand All @@ -63,4 +65,6 @@ std = [
'dep:sp-rpc',
'dep:num-traits',
'dep:jsonrpsee',
'dep:regex',
'dep:url',
]
1 change: 1 addition & 0 deletions utilities/src/with_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub mod spmc;
pub mod task_scope;
pub mod unending_stream;
pub use unending_stream::UnendingStream;
pub mod redact_endpoint_secret;

pub mod serde_helpers;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::Context;
use regex::Regex;
use url::Url;

const MAX_SECRET_CHARACTERS_REVEALED: usize = 3;
const SCHEMA_PADDING_LEN: usize = 3;
Expand All @@ -25,7 +26,7 @@ pub fn redact_secret_eth_node_endpoint(endpoint: &str) -> Result<String, anyhow:
Ok(endpoint_redacted)
} else {
// No secret was found, so just redact almost all of the url
let url = url::Url::parse(endpoint).context("Failed to parse node endpoint into a URL")?;
let url = Url::parse(endpoint).context("Failed to parse node endpoint into a URL")?;
Ok(format!(
"{}****",
endpoint
Expand Down

0 comments on commit d21c68f

Please sign in to comment.