Skip to content

Real-time network monitor + outbound firewall — see & block every connection. Privacy-first, local-first, Rust fleet agent, SIEM exports, 8 languages. / Moniteur réseau temps réel + pare-feu sortant, agent de flotte Rust, exports SIEM. 100 % local.

Fix: accept file:// WS origin — Electron renderer was rejected (Disconnected)

MoneyLisa87cb60aaa927
diff --git a/backend/api/security.py b/backend/api/security.py
index c79edf2..1f2d7f2 100644
--- a/backend/api/security.py
+++ b/backend/api/security.py
@@ -64,14 +64,26 @@ def _is_loopback_origin(origin: str) -> bool:
def origin_allowed(origin: str | None) -> bool:
"""
EN: An absent Origin header means a non-browser client (curl, Electron's
- main process) — allowed. Present origins must be loopback or `null`.
+ main process) — allowed. Present origins must be loopback, `null`,
+ or `file://` — Chromium inside Electron serialises the WebSocket
+ Origin of a file:// page as literally `file://` (not `null` like a
+ browser does), so without this the packaged app's own renderer was
+ rejected with 403 and the UI stayed "Disconnected". A file:// origin
+ can only come from a local page, and the token check still applies.
FR: Un en-tête Origin absent signifie un client non-navigateur (curl,
processus principal d'Electron) — autorisé. Les origines présentes
- doivent être loopback ou `null`.
+ doivent être loopback, `null` ou `file://` — Chromium sous Electron
+ sérialise l'Origin WebSocket d'une page file:// littéralement en
+ `file://` (pas `null` comme un navigateur), donc sans cela le renderer
+ de l'app empaquetée était rejeté en 403 et l'UI restait « Déconnecté ».
+ Une origine file:// ne peut venir que d'une page locale, et le
+ contrôle du jeton s'applique toujours.
"""
if origin is None:
return True
- return origin == "null" or _is_loopback_origin(origin)
+ if origin == "null" or origin.startswith("file:"):
+ return True
+ return _is_loopback_origin(origin)
# EN: CORS needs literal strings/regex — a loopback regex mirrors the rule.
diff --git a/electron/package.json b/electron/package.json
index 44b385c..378a45c 100644
--- a/electron/package.json
+++ b/electron/package.json
@@ -1,6 +1,6 @@
{
"name": "snitch",
- "version": "1.0.1",
+ "version": "1.0.2",
"description": "Snitch — real-time network traffic visualizer / visualiseur de trafic réseau en temps réel",
"main": "main.js",
"license": "AGPL-3.0-or-later",
diff --git a/frontend/package.json b/frontend/package.json
index 0a7a06d..e86bafa 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "snitch-frontend",
- "version": "1.0.1",
+ "version": "1.0.2",
"private": true,
"license": "AGPL-3.0-or-later",
"description": "Snitch UI — React + D3.js / Interface React + D3.js",