Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(tauri): allow ws: in connect-src for remote cores

Steven Enamakel9141acc51805
diff --git a/app/src/utils/tauriCsp.test.ts b/app/src/utils/tauriCsp.test.ts
index 593201b662..d61d80587c 100644
--- a/app/src/utils/tauriCsp.test.ts
+++ b/app/src/utils/tauriCsp.test.ts
@@ -14,6 +14,14 @@ const scriptSourceTokens =
?.split(/\s+/)
.slice(1) ?? [];
+const connectSourceTokens =
+ config.app?.security?.csp
+ ?.split(';')
+ .map(directive => directive.trim())
+ .find(directive => directive.startsWith('connect-src '))
+ ?.split(/\s+/)
+ .slice(1) ?? [];
+
describe('Tauri content security policy', () => {
it('allows scripts served from the Wry custom scheme', () => {
expect(scriptSourceTokens).toEqual(expect.arrayContaining(['tauri:', 'tauri://localhost']));
@@ -24,4 +32,8 @@ describe('Tauri content security policy', () => {
expect.arrayContaining(["'self'", "'wasm-unsafe-eval'", 'https://www.googletagmanager.com'])
);
});
+
+ it('allows WebSocket connections to configured remote cores over plain HTTP', () => {
+ expect(connectSourceTokens).toContain('ws:');
+ });
});
diff --git a/crates/openhuman-app/tauri.conf.json b/crates/openhuman-app/tauri.conf.json
index 8c739278bb..8a1c9d7ab4 100644
--- a/crates/openhuman-app/tauri.conf.json
+++ b/crates/openhuman-app/tauri.conf.json
@@ -30,7 +30,7 @@
}
],
"security": {
- "csp": "default-src 'self' 'unsafe-inline' data: blob: https: wss: ipc: http://ipc.localhost http://127.0.0.1:* http://localhost:*; script-src 'self' 'wasm-unsafe-eval' https://www.googletagmanager.com tauri: tauri://localhost; img-src 'self' data: blob: https:; connect-src 'self' ipc: http://ipc.localhost http://127.0.0.1:* http://localhost:* ws://127.0.0.1:* ws://localhost:* https: wss: data: blob: https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com; frame-src 'self' https: data: blob:"
+ "csp": "default-src 'self' 'unsafe-inline' data: blob: https: wss: ipc: http://ipc.localhost http://127.0.0.1:* http://localhost:*; script-src 'self' 'wasm-unsafe-eval' https://www.googletagmanager.com tauri: tauri://localhost; img-src 'self' data: blob: https:; connect-src 'self' ipc: http://ipc.localhost http://127.0.0.1:* http://localhost:* ws://127.0.0.1:* ws://localhost:* ws: https: wss: data: blob: https://*.google-analytics.com https://*.analytics.google.com https://*.googletagmanager.com; frame-src 'self' https: data: blob:"
},
"macOSPrivateApi": true
},