Skip to content

Commit

Permalink
Stop logging viewing keys in the config (#8064)
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 authored Dec 6, 2023
1 parent 9fec711 commit e692b94
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion zebra-scan/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
//! Configuration for blockchain scanning tasks.
use std::fmt::Debug;

use indexmap::IndexMap;
use serde::{Deserialize, Serialize};

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 {
Expand All @@ -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 {
Expand Down

0 comments on commit e692b94

Please sign in to comment.