Skip to content

Commit

Permalink
[bug] hyperledger-iroha#2422: Hide private keys in configuration endp…
Browse files Browse the repository at this point in the history
…oint response

Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
  • Loading branch information
Erigara committed Jul 22, 2022
1 parent b683c58 commit 4ba47ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion cli/src/torii/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use iroha_core::{
};
use iroha_crypto::SignatureOf;
use iroha_data_model::{
config::Configuration as PublicConfiguration,
predicate::PredicateBox,
prelude::*,
query::{self, SignedQueryRequest},
Expand Down Expand Up @@ -189,7 +190,9 @@ async fn handle_get_configuration(
.wrap_err("Failed to get docs {:?field}")
.and_then(|doc| serde_json::to_value(doc).wrap_err("Failed to serialize docs"))
}
Value => serde_json::to_value(iroha_cfg).wrap_err("Failed to serialize value"),
// Cast to public configuration to hide private keys.
Value => serde_json::to_value(PublicConfiguration::from(iroha_cfg))
.wrap_err("Failed to serialize value"),
}
.map(|v| reply::json(&v))
.map_err(Error::Config)
Expand Down
2 changes: 1 addition & 1 deletion config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub mod derive {
/// ## Container attributes
///
/// ### `#[view(ViewType)]`
/// Sets container type view type.
/// Sets container view type.
///
/// ## Field attributes
/// ### `#[view(ignore)]`
Expand Down
6 changes: 3 additions & 3 deletions data_model/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub mod genesis {
/// Module for wsv-related configuration and structs.
pub mod wsv {
use super::*;
use crate::metadata::Limits as MetadataLimits;
use crate::{metadata::Limits as MetadataLimits, LengthLimits};

/// `WorldStateView` configuration.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
Expand All @@ -251,8 +251,8 @@ pub mod wsv {
/// [`MetadataLimits`] of any domain's metadata.
pub domain_metadata_limits: MetadataLimits,
/// [`LengthLimits`] for the number of chars in identifiers that can be stored in the WSV.
pub ident_length_limits: crate::LengthLimits,
/// [`WASM Runtime`](wasm::Runtime) configuration
pub ident_length_limits: LengthLimits,
/// WASM Runtime configuration
pub wasm_runtime_config: wasm::Configuration,
}
}
Expand Down

0 comments on commit 4ba47ea

Please sign in to comment.