v0.2.6-pre.008
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_security.rs
|
||||
// version: 7
|
||||
// version: 8
|
||||
|
||||
//! Static desktop security contracts for the Wallet Desk pre.002 shell.
|
||||
|
||||
@@ -126,3 +126,39 @@ fn balance_refresh_never_accepts_pubkey_or_endpoint_url_from_frontend() {
|
||||
assert!(!main.contains("endpointUrl"));
|
||||
assert!(state.contains("wallet.pubkey()"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_picker_path_and_transfer_secret_never_cross_into_frontend() {
|
||||
let root = app_root();
|
||||
let package = read_text(root.join("package.json").as_path());
|
||||
let capability = read_text(root.join("capabilities/default.json").as_path());
|
||||
let import = read_text(root.join("src/wallet_import.rs").as_path());
|
||||
let tauri = read_text(root.join("src/tauri.rs").as_path());
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(!package.contains("@tauri-apps/plugin-dialog"));
|
||||
assert!(!capability.contains("dialog:"));
|
||||
assert!(!capability.contains("fs:"));
|
||||
assert!(!main.contains("@tauri-apps/plugin-dialog"));
|
||||
assert!(!main.contains("sourcePath"));
|
||||
assert!(!main.contains("source_path"));
|
||||
assert!(import.contains("zeroize::Zeroizing"));
|
||||
let inspection = import.split("pub(crate) struct WalletTransferInspectionDto").nth(1);
|
||||
assert!(inspection.is_some());
|
||||
let inspection = inspection.unwrap_or_default().split("}\n").next().unwrap_or_default();
|
||||
let inspection_fields = inspection.lines().filter(|line| return line.trim_start().starts_with("pub(crate) ")).collect::<std::vec::Vec<_>>().join("\n");
|
||||
assert!(!inspection_fields.contains("path"));
|
||||
assert!(!inspection_fields.contains("password"));
|
||||
let request = import.split("pub(crate) struct WalletImportRequestDto").nth(1);
|
||||
assert!(request.is_some());
|
||||
let request = request.unwrap_or_default().split("}\n").next().unwrap_or_default();
|
||||
let request_fields = request.lines().filter(|line| return line.trim_start().starts_with("pub(crate) ")).collect::<std::vec::Vec<_>>().join("\n");
|
||||
assert!(request_fields.contains("owner_password"));
|
||||
assert!(request_fields.contains("view_password"));
|
||||
assert!(!request_fields.contains("path"));
|
||||
let command_start = tauri.find("async fn inspect_import_source");
|
||||
assert!(command_start.is_some());
|
||||
let command = &tauri[command_start.unwrap_or_default()..];
|
||||
let command = command.split("#[tauri::command]").next().unwrap_or_default();
|
||||
assert!(command.contains("WalletImportSourceRequestDto"));
|
||||
assert!(!command.contains("source_path"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user