From f279b63f5441971da8d1aea524800957e1c4f849 Mon Sep 17 00:00:00 2001 From: Denis Kolegov Date: Wed, 1 Nov 2023 18:56:00 +0100 Subject: [PATCH] make private keys readable for owners only --- ipc/cli/src/commands/wallet/export.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ipc/cli/src/commands/wallet/export.rs b/ipc/cli/src/commands/wallet/export.rs index 08b3dadb..12009d91 100644 --- a/ipc/cli/src/commands/wallet/export.rs +++ b/ipc/cli/src/commands/wallet/export.rs @@ -9,7 +9,9 @@ use fvm_shared::address::Address; use ipc_identity::{EvmKeyStore, PersistentKeyInfo, WalletType}; use ipc_provider::{lotus::message::wallet::WalletKeyType, IpcProvider, LotusJsonKeyType}; use std::fmt::Debug; +use std::fs::Permissions; use std::io::Write; +use std::os::unix::fs::PermissionsExt; use std::str::FromStr; use crate::{get_ipc_provider, CommandLineHandler, GlobalArguments}; @@ -81,6 +83,7 @@ impl CommandLineHandler for WalletExport { match &arguments.output { Some(p) => { let mut file = std::fs::File::create(p)?; + file.set_permissions(Permissions::from_mode(0o600))?; file.write_all(v.as_bytes())?; println!( "exported new wallet with address {:?} in file {:?}",