Skip to content

Commit

Permalink
feat: add back isolation pattern (tari-project#1334)
Browse files Browse the repository at this point in the history
Adds back the tauri isolation pattern that was lost in v2 upgrade

---------

Co-authored-by: brianp <[email protected]>
Co-authored-by: Brian Pearce <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent 0aceb44 commit cf3c3a5
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .license.ignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
./public/assets/glApp.js
./dist-isolation/index.js
./public/assets/glApp.js
14 changes: 13 additions & 1 deletion dist-isolation/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<title>Isolation Secure Script</title>
</head>

<body>
<script src="index.js"></script>
<script>
window.__TAURI_ISOLATION_HOOK__ = (payload) => {
// console.debug("Isolation hook called with payload:", payload);
// TODO: Prevent command execution
// TODO: Perhaps whitelist commands
console.log("Isolation hook called with payload:", payload);
return payload;
};

</script>
</body>

</html>
6 changes: 0 additions & 6 deletions dist-isolation/index.js

This file was deleted.

36 changes: 35 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "0.8.42"

[build-dependencies]
embed-resource = "2.5.0"
tauri-build = { version = "2", features = [] }
tauri-build = { version = "2", features = ["isolation"] }

[dependencies]
anyhow = "1"
Expand Down Expand Up @@ -69,6 +69,7 @@ tari_key_manager = { git = "https://github.com/tari-project/tari.git", tag = "v1
tari_shutdown = { git = "https://github.com/tari-project/tari.git", tag = "v1.9.1-rc.1" }
tari_utilities = "0.8.0"
tauri = { git = "https://github.com/tari-project/tauri.git", rev = "67a06c8a9bae94f412b8059dfa8b4d8dd8ea0a25", features = [
"isolation",
"macos-private-api",
"image-png",
"image-ico",
Expand Down
8 changes: 7 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@
"default",
"migrated"
],
"csp": null
"csp": null,
"pattern": {
"use": "isolation",
"options": {
"dir": "../dist-isolation"
}
}
},
"trayIcon": {
"id": "universe-tray-id",
Expand Down

0 comments on commit cf3c3a5

Please sign in to comment.