Skip to content

Commit

Permalink
feat(575): WIP hiding secrets in logging not working
Browse files Browse the repository at this point in the history
Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik committed Oct 31, 2023
1 parent 8a5f71e commit 2ca6bf1
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 18 deletions.
15 changes: 14 additions & 1 deletion Cargo.lock

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

18 changes: 11 additions & 7 deletions commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,22 @@ validated_struct::validator! {
pub tls: #[derive(Default)]
TLSConf {
root_ca_certificate: Option<String>,
root_ca_certificate_base64: Option<String>,
server_private_key: Option<String>,
server_private_key_base64: Option<String>,
server_certificate: Option<String>,
server_certificate_base64: Option<String>,
client_auth: Option<bool>,
client_private_key: Option<String>,
client_private_key_base64 : Option<String>,
client_certificate: Option<String>,
client_certificate_base64 : Option<String>,
server_name_verification: Option<bool>
},
server_name_verification: Option<bool>,
pub private : #[derive(Default)]
Base64Data {
root_ca_certificate_base64: Option<String>,
server_private_key_base64: Option<String>,
server_certificate_base64: Option<String>,
client_private_key_base64 : Option<String>,
client_certificate_base64 : Option<String>,
}
}
,
pub unixpipe: #[derive(Default)]
UnixPipeConf {
file_access_mask: Option<u32>
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-links/zenoh-link-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ zenoh-protocol = { workspace = true }
zenoh-result = { workspace = true }
zenoh-sync = { workspace = true }
zenoh-util = { workspace = true }
base64 = { workspace = true }
base64 = { workspace = true }
15 changes: 12 additions & 3 deletions io/zenoh-links/zenoh-link-quic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ impl ConfigurationInspector<Config> for QuicConfigurator {

let c = config.transport().link().tls();

match (c.root_ca_certificate(), c.root_ca_certificate_base64()) {
match (
c.root_ca_certificate(),
c.private().root_ca_certificate_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'root_ca_certificate' and 'root_ca_certificate_base64' can be present!")
}
Expand All @@ -87,7 +90,10 @@ impl ConfigurationInspector<Config> for QuicConfigurator {
_ => {}
}

match (c.server_private_key(), c.server_private_key_base64()) {
match (
c.server_private_key(),
c.private().server_private_key_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'server_private_key' and 'server_private_key_base64' can be present!")
}
Expand All @@ -100,7 +106,10 @@ impl ConfigurationInspector<Config> for QuicConfigurator {
_ => {}
}

match (c.server_certificate(), c.server_certificate_base64()) {
match (
c.server_certificate(),
c.private().server_certificate_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'server_certificate' and 'server_certificate_base64' can be present!")
}
Expand Down
2 changes: 1 addition & 1 deletion io/zenoh-links/zenoh-link-tls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ zenoh-protocol = { workspace = true }
zenoh-result = { workspace = true }
zenoh-sync = { workspace = true }
zenoh-util = { workspace = true }
base64 = { workspace = true }
base64 = { workspace = true }
25 changes: 20 additions & 5 deletions io/zenoh-links/zenoh-link-tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ impl ConfigurationInspector<Config> for TlsConfigurator {

let c = config.transport().link().tls();

match (c.root_ca_certificate(), c.root_ca_certificate_base64()) {
match (
c.root_ca_certificate(),
c.private().root_ca_certificate_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'root_ca_certificate' and 'root_ca_certificate_base64' can be present!")
}
Expand All @@ -84,7 +87,10 @@ impl ConfigurationInspector<Config> for TlsConfigurator {
_ => {}
}

match (c.server_private_key(), c.server_private_key_base64()) {
match (
c.server_private_key(),
c.private().server_private_key_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'server_private_key' and 'server_private_key_base64' can be present!")
}
Expand All @@ -97,7 +103,10 @@ impl ConfigurationInspector<Config> for TlsConfigurator {
_ => {}
}

match (c.server_certificate(), c.server_certificate_base64()) {
match (
c.server_certificate(),
c.private().server_certificate_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'server_certificate' and 'server_certificate_base64' can be present!")
}
Expand All @@ -117,7 +126,10 @@ impl ConfigurationInspector<Config> for TlsConfigurator {
};
}

match (c.client_private_key(), c.client_private_key_base64()) {
match (
c.client_private_key(),
c.private().client_private_key_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'client_private_key' and 'client_private_key_base64' can be present!")
}
Expand All @@ -130,7 +142,10 @@ impl ConfigurationInspector<Config> for TlsConfigurator {
_ => {}
}

match (c.client_certificate(), c.client_certificate_base64()) {
match (
c.client_certificate(),
c.private().client_certificate_base64(),
) {
(Some(_), Some(_)) => {
bail!("Only one between 'client_certificate' and 'client_certificate_base64' can be present!")
}
Expand Down

0 comments on commit 2ca6bf1

Please sign in to comment.