v0.2.6-pre.006
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_security.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Static desktop security contracts for the Wallet Desk pre.002 shell.
|
||||
|
||||
@@ -66,3 +66,37 @@ fn create_passwords_are_request_only_and_protected_projection_is_purged() {
|
||||
assert!(!main.contains("frontendDebug(\"main\", request.ownerPassword"));
|
||||
assert!(!main.contains("frontendTrace(\"main\", request.viewPassword"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unlock_passwords_and_config_secret_names_never_cross_rust_to_frontend() {
|
||||
let root = app_root();
|
||||
let session = read_text(root.join("src/wallet_session.rs").as_path());
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
let html = read_text(root.join("frontend/main.html").as_path());
|
||||
let authorized = session.split("pub(crate) struct WalletAuthorizedDto").nth(1);
|
||||
assert!(authorized.is_some());
|
||||
let authorized = authorized.unwrap_or_default().split("}\n\n/// Create request").next().unwrap_or_default();
|
||||
assert!(!authorized.contains("password"));
|
||||
let unlock_request = session.find("pub(crate) struct WalletUnlockRequestDto");
|
||||
assert!(unlock_request.is_some());
|
||||
assert!(session[unlock_request.unwrap_or_default()..].contains("password: String"));
|
||||
assert!(main.contains("clearUnlockSensitiveInputs"));
|
||||
assert!(!main.contains("KSP_SECRET_WALLET_PASS_"));
|
||||
assert!(!html.contains("KSP_SECRET_WALLET_PASS_"));
|
||||
assert!(!main.contains("variableName"));
|
||||
assert!(!main.contains("effectiveSource"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wallet_selection_does_not_auto_unlock_configured_secrets() {
|
||||
let root = app_root();
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
let selection_start = main.find("async function selectWallet");
|
||||
let selection_end = main.find("function bindWalletTableSelection");
|
||||
assert!(selection_start.is_some());
|
||||
assert!(selection_end.is_some());
|
||||
let selection = &main[selection_start.unwrap_or_default()..selection_end.unwrap_or(main.len())];
|
||||
assert!(selection.contains("select_wallet"));
|
||||
assert!(!selection.contains("unlock_wallet_view_configured"));
|
||||
assert!(!selection.contains("unlock_wallet_owner_configured"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user