Skip to content

Commit 463fd00

Browse files
fix(csp): add wss and tauri to conf template (#1974)
* fix(csp): add wss and tauri to conf template * add change file, update examples/docs Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent fb1f483 commit 463fd00

File tree

17 files changed

+68
-39
lines changed

17 files changed

+68
-39
lines changed

.changes/template-csp-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.rs": patch
3+
---
4+
5+
Change the `csp` value on the template to include `wss:` and `tauri:` to the `default-src` attribute.

core/tauri/test/fixture/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"security": {
20-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
20+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
2121
},
2222
"updater": {
2323
"active": false

docs/api/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ Instead of launching the app directly, we configure the bundled app to run a scr
358358
"fullscreen": false
359359
}],
360360
"security": {
361-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'"
361+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
362362
}
363363
}
364364
```

docs/usage/development/integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ App directory structure
107107
App
108108
tauri.rs - 1.0.0-beta.1
109109
build-type - bundle
110-
CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
110+
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
111111
distDir - ../public
112112
devPath - ../public
113113
framework - Svelte

examples/api/src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@
7878
}
7979
],
8080
"security": {
81-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
81+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
8282
},
8383
"systemTray": {
8484
"iconPath": "../../.icons/icon.png"
8585
}
8686
}
87-
}
87+
}

examples/commands/src-tauri/tauri.conf.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"build": {
3-
"distDir": ["../index.html"],
4-
"devPath": ["../index.html"],
3+
"distDir": [
4+
"../index.html"
5+
],
6+
"devPath": [
7+
"../index.html"
8+
],
59
"beforeDevCommand": "",
610
"beforeBuildCommand": ""
711
},
@@ -47,10 +51,10 @@
4751
}
4852
],
4953
"security": {
50-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
54+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
5155
},
5256
"updater": {
5357
"active": false
5458
}
5559
}
56-
}
60+
}

examples/helloworld/src-tauri/tauri.conf.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"build": {
3-
"distDir": ["../index.html"],
4-
"devPath": ["../index.html"],
3+
"distDir": [
4+
"../index.html"
5+
],
6+
"devPath": [
7+
"../index.html"
8+
],
59
"beforeDevCommand": "",
610
"beforeBuildCommand": ""
711
},
@@ -47,10 +51,10 @@
4751
}
4852
],
4953
"security": {
50-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
54+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
5155
},
5256
"updater": {
5357
"active": false
5458
}
5559
}
56-
}
60+
}

examples/multiwindow/src-tauri/tauri.conf.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"build": {
3-
"distDir": ["../index.html"],
4-
"devPath": ["../index.html"],
3+
"distDir": [
4+
"../index.html"
5+
],
6+
"devPath": [
7+
"../index.html"
8+
],
59
"withGlobalTauri": true
610
},
711
"tauri": {
@@ -39,7 +43,7 @@
3943
}
4044
],
4145
"security": {
42-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
46+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
4347
},
4448
"updater": {
4549
"active": false

examples/navigation/src-tauri/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
}
4949
],
5050
"security": {
51-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
51+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
5252
},
5353
"updater": {
5454
"active": false
5555
}
5656
}
57-
}
57+
}

examples/params/src-tauri/tauri.conf.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"build": {
3-
"distDir": ["../index.html"],
4-
"devPath": ["../index.html"],
3+
"distDir": [
4+
"../index.html"
5+
],
6+
"devPath": [
7+
"../index.html"
8+
],
59
"beforeDevCommand": "",
610
"beforeBuildCommand": ""
711
},
@@ -47,10 +51,10 @@
4751
}
4852
],
4953
"security": {
50-
"csp": "default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' 'self'"
54+
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'"
5155
},
5256
"updater": {
5357
"active": false
5458
}
5559
}
56-
}
60+
}

0 commit comments

Comments
 (0)