From bd3342a57e04d2ce8b181f22e020903f0c39e1ca Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 6 Dec 2023 11:41:30 +1000 Subject: [PATCH] Stop logging viewing keys in the config --- zebra-scan/src/config.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/zebra-scan/src/config.rs b/zebra-scan/src/config.rs index df217e90629..734791e884c 100644 --- a/zebra-scan/src/config.rs +++ b/zebra-scan/src/config.rs @@ -1,5 +1,7 @@ //! Configuration for blockchain scanning tasks. +use std::fmt::Debug; + use indexmap::IndexMap; use serde::{Deserialize, Serialize}; @@ -7,7 +9,7 @@ use zebra_state::Config as DbConfig; use crate::storage::SaplingScanningKey; -#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)] +#[derive(Clone, Eq, PartialEq, Deserialize, Serialize)] #[serde(deny_unknown_fields, default)] /// Configuration for scanning. pub struct Config { @@ -25,6 +27,16 @@ pub struct Config { db_config: DbConfig, } +impl Debug for Config { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Config") + // Security: don't log private keys, birthday heights might also be private + .field("sapling_keys_to_scan", &self.sapling_keys_to_scan.len()) + .field("db_config", &self.db_config) + .finish() + } +} + impl Default for Config { fn default() -> Self { Self {