From b47b07fc45838050fe0d63d48c7a18b1f2cc3103 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Mon, 4 Nov 2019 16:42:17 +0000 Subject: [PATCH] fix: do not log sensitive information Logs may be leaked accidentally and additional processing increases the chance that this information will remain in memory. Logging can be added as needed if required for debugging. Related to #43 --- src/composed/signed_key/key_parser_macros.rs | 3 +-- src/packet/secret_key_macro.rs | 2 -- src/packet/signature/config.rs | 4 ---- src/packet/signature/types.rs | 1 - 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/composed/signed_key/key_parser_macros.rs b/src/composed/signed_key/key_parser_macros.rs index ecc6d71d4..721ea27c4 100644 --- a/src/composed/signed_key/key_parser_macros.rs +++ b/src/composed/signed_key/key_parser_macros.rs @@ -31,9 +31,8 @@ macro_rules! key_parser { Some(n) => n, None => return None }; - info!(" primary key: {:#?}", next); let primary_key: $inner_key_type = err_opt!(next.try_into()); - info!(" {:?}", primary_key.key_id()); + info!("primary key: {:?}", primary_key.key_id()); // -- Zero or more revocation signatures // -- followed by zero or more direct signatures in V4 keys diff --git a/src/packet/secret_key_macro.rs b/src/packet/secret_key_macro.rs index fd4a8b30d..9009a936c 100644 --- a/src/packet/secret_key_macro.rs +++ b/src/packet/secret_key_macro.rs @@ -178,8 +178,6 @@ macro_rules! impl_secret_key { use $crate::crypto::ECCCurve; use $crate::types::{PublicParams, SecretKeyRepr}; - info!("signing data: {}", hex::encode(&data)); - let mut signature: Option> = None; self.unlock(key_pw, |priv_key| { info!("unlocked key"); diff --git a/src/packet/signature/config.rs b/src/packet/signature/config.rs index f72c3aba4..cb3518e8f 100644 --- a/src/packet/signature/config.rs +++ b/src/packet/signature/config.rs @@ -94,9 +94,6 @@ impl SignatureConfig { let mut packet_buf = Vec::new(); id.to_writer(&mut packet_buf)?; - info!("key: ({:?}), {}", key.key_id(), hex::encode(&key_buf)); - info!("packet: {}", hex::encode(&packet_buf)); - hasher.update(&key_buf); match self.version { @@ -112,7 +109,6 @@ impl SignatureConfig { let mut prefix_buf = [prefix, 0u8, 0u8, 0u8, 0u8]; BigEndian::write_u32(&mut prefix_buf[1..], packet_buf.len() as u32); - info!("prefix: {}", hex::encode(&prefix_buf)); // prefixes hasher.update(&prefix_buf); diff --git a/src/packet/signature/types.rs b/src/packet/signature/types.rs index ba0ded9ee..e361f5092 100644 --- a/src/packet/signature/types.rs +++ b/src/packet/signature/types.rs @@ -131,7 +131,6 @@ impl Signature { let mut packet_buf = Vec::new(); id.to_writer(&mut packet_buf)?; - info!("key: ({:?}), {}", key.key_id(), hex::encode(&key_buf)); info!("packet: {}", hex::encode(&packet_buf)); hasher.update(&key_buf);