Stop logging viewing keys in the config (#8064)

This commit is contained in:
teor 2023-12-07 07:58:12 +10:00 committed by GitHub
parent 9fec7116ca
commit e692b943d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -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 {