Skip to content

Commit 097f533

Browse files
committed
add test
1 parent 28aad6e commit 097f533

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/host.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,4 +467,24 @@ mod tests {
467467
peer.as_uapi_remove()
468468
);
469469
}
470+
471+
#[test]
472+
fn dg25_28_test_dont_expose_preshared_keys() {
473+
let preshared_key_str = "000102030405060708090a0b0c0d0e0ff0e1d2c3b4a5968778695a4b3c2d1e0f";
474+
let peer = Peer {
475+
public_key: Key::decode("286ac5ff9b2f900259008172225da774031e8a3689d8f341667be157b2336970").unwrap(),
476+
preshared_key: Some(Key::decode(preshared_key_str).unwrap()),
477+
protocol_version: None,
478+
endpoint: None,
479+
last_handshake: None,
480+
tx_bytes: 0,
481+
rx_bytes: 0,
482+
persistent_keepalive_interval: None,
483+
allowed_ips: Vec::new(),
484+
};
485+
486+
let debug = format!("{peer:?}");
487+
assert!(!debug.contains("preshared_key"));
488+
assert!(!debug.contains(preshared_key_str));
489+
}
470490
}

0 commit comments

Comments
 (0)