Skip to content

Commit 3a40502

Browse files
committed
opt: add zeroize for sensitive data struct
1 parent ab1d0fe commit 3a40502

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::{
1515
use arc_swap::{ArcSwap, ArcSwapOption};
1616
use go_defer::defer;
1717
use serde::{Deserialize, Serialize};
18-
use zeroize::Zeroizing;
18+
use zeroize::{Zeroize, Zeroizing};
1919

2020
use crate::{
2121
cli::config::MountEntryHMACLevel,
@@ -55,14 +55,17 @@ impl SealConfig {
5555
}
5656
}
5757

58-
#[derive(Debug, Clone, PartialEq)]
58+
#[derive(Debug, Clone, PartialEq, Zeroize)]
59+
#[zeroize(drop)]
5960
pub struct InitResult {
6061
pub secret_shares: Zeroizing<Vec<Vec<u8>>>,
6162
pub root_token: String,
6263
}
6364

64-
#[derive(Clone)]
65+
#[derive(Clone, Zeroize)]
66+
#[zeroize(drop)]
6567
pub struct CoreState {
68+
#[zeroize(skip)]
6669
pub system_view: Option<Arc<BarrierView>>,
6770
pub sealed: bool,
6871
pub unseal_key_shares: Vec<Vec<u8>>,

0 commit comments

Comments
 (0)