Change to Isolation Pattern

This commit is contained in:
Sebastian Martinez
2024-07-24 14:39:55 -03:00
parent 188bcd4d9c
commit dc4b65c04d
8 changed files with 45 additions and 4 deletions
+1 -1
View File
@@ -134,9 +134,9 @@ export default [
},
{
ignores: [
"isolation/*",
"node_modules/**/*",
"src-tauri/**/*",
".svelte-kit/**/*",
"eslint.config.js",
],
},
+13
View File
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Isolation Secure Script</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
+5
View File
@@ -0,0 +1,5 @@
window.__TAURI_ISOLATION_HOOK__ = payload => {
// let's not verify or modify anything, just print the content from the hook
console.log("hook", payload);
return payload;
};
+6
View File
@@ -647,6 +647,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"rand_core 0.6.4",
"typenum",
]
@@ -4071,6 +4072,7 @@ dependencies = [
"tray-icon",
"url",
"urlpattern",
"uuid",
"webkit2gtk",
"webview2-com",
"window-vibrancy",
@@ -4093,6 +4095,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"tauri-codegen",
"tauri-utils",
"tauri-winres",
"toml 0.8.2",
@@ -4227,10 +4230,12 @@ version = "2.0.0-beta.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e20e51856f343c503892749b27d34042e6ca83a0369a12de3c5552d9874d04e8"
dependencies = [
"aes-gcm",
"brotli",
"cargo_metadata",
"ctor",
"dunce",
"getrandom 0.2.15",
"glob",
"html5ever",
"infer",
@@ -4248,6 +4253,7 @@ dependencies = [
"serde-untagged",
"serde_json",
"serde_with",
"serialize-to-javascript",
"swift-rs",
"thiserror",
"toml 0.8.2",
+10 -2
View File
@@ -16,11 +16,19 @@ name = "app_lib"
crate-type = ["staticlib", "cdylib", "lib"]
[build-dependencies]
tauri-build = { version = "2.0.0-beta.19", features = [] }
tauri-build = { version = "2.0.0-beta.19", features = ["isolation"] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-beta.24", features = [] }
tauri = { version = "2.0.0-beta.24", features = ["isolation"] }
tauri-plugin-shell = "2.0.0-beta.9"
radicle = "0.12.0"
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]
+6
View File
@@ -18,6 +18,12 @@
],
"security": {
"csp": null
"pattern": {
"use": "isolation",
"options": {
"dir": "../isolation"
}
}
}
},
"bundle": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"include": ["src", "./*.js", "./*.ts"],
"exclude": ["node_modules/*"],
"exclude": ["node_modules/*", "isolation/*"],
"compilerOptions": {
"noEmit": true,
"target": "es2021",
+3
View File
@@ -4,6 +4,9 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
build: {
outDir: "build",
},
// prevent vite from obscuring rust errors
clearScreen: false,
server: {