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.

Add permanent ask verdicts and translation docs

MoneyLisa387b59db1d05
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d09f32..47c1d52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@ All notable changes to Snitch. / Toutes les modifications notables de Snitch.
The format follows [Keep a Changelog](https://keepachangelog.com/) — EN/FR.
+## [1.5.3] — 2026-10-22
+
+### Added / Ajouté
+
+- **Permanent ask verdicts / Verdicts ask permanents** — `POST /security/ask/verdict` accepts `permanent`: allow-always writes the IP to `whitelisted_ips` (and gets an iptables RETURN exemption at next start, so the flow is never re-asked), deny-always creates a persisted firewall block rule. The UI now offers all four classic choices. / `permanent` sur le verdict ask : autoriser-toujours whitelist l'IP (+ exemption iptables au prochain start), refuser-toujours crée une règle de blocage persistée. Les quatre choix classiques sont dans l'UI.
+- **Translation contribution docs / Doc contribution traductions** — README explains how to add a language (one file under `frontend/src/locales/` + registration in `i18n.jsx`). / Le README explique comment ajouter une langue (un fichier dans `frontend/src/locales/` + enregistrement dans `i18n.jsx`).
+
## [1.5.2] — 2026-10-22
### Added / Ajouté
diff --git a/CITATION.cff b/CITATION.cff
index a106bdc..83a425f 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -17,5 +17,5 @@ keywords:
- privacy
- traffic visualization
- cybersecurity
-version: "1.5.2"
+version: "1.5.3"
date-released: "2026-10-01"
diff --git a/README.md b/README.md
index 3bba76f..c944c7e 100644
--- a/README.md
+++ b/README.md
@@ -241,6 +241,19 @@ snitch/
└── dist/ Compiled output (backend exe, installer)
```
+### Contribute
+
+Bug reports and PRs are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
+
+**Translations** — the UI is fully localized in 8 languages and every string
+lives in a single plain file per locale under `frontend/src/locales/`
+(`en.js`, `fr.js`, `de.js`, `es.js`, `ru.js`, `ja.js`, `pt-BR.js`,
+`zh-CN.js`). Adding Polish, Korean, Italian or any other language is a
+one-file, zero-code-change pull request: copy `en.js`, translate the
+values, then register the import, `LANGS` entry and display name in
+`frontend/src/i18n.jsx`. Docs (`PRIVACY`, `FIREWALL`, `CHANGELOG`…)
+follow the same per-language file pattern.
+
---
## Français
@@ -398,6 +411,20 @@ snitch/
└── dist/ Sortie compilée (exe backend, installateur)
```
+### Contribuer
+
+Rapports de bugs et PR bienvenus — voir [CONTRIBUTING.md](CONTRIBUTING.md).
+
+**Traductions** — l'UI est entièrement localisée en 8 langues et chaque
+chaîne vit dans un seul fichier par locale sous `frontend/src/locales/`
+(`en.js`, `fr.js`, `de.js`, `es.js`, `ru.js`, `ja.js`, `pt-BR.js`,
+`zh-CN.js`). Ajouter le polonais, le coréen, l'italien ou toute autre
+langue est une PR d'un seul fichier, sans toucher au code : copier
+`en.js`, traduire les valeurs, puis enregistrer l'import, l'entrée
+`LANGS` et le nom d'affichage dans `frontend/src/i18n.jsx`. Les docs
+(`PRIVACY`, `FIREWALL`, `CHANGELOG`…) suivent le même schéma de
+fichier par langue.
+
---
## License / Licence
diff --git a/backend/api/main.py b/backend/api/main.py
index edefd99..453e7a7 100644
--- a/backend/api/main.py
+++ b/backend/api/main.py
@@ -324,13 +324,18 @@ class IocImportBody(BaseModel):
class AskVerdictBody(BaseModel):
"""EN: /security/ask/verdict payload — allow/deny one pending flow.
- `remember` stores the decision for the session (default True).
+ Decisions persist per flow-key for the session; `permanent=True`
+ additionally writes durable policy: allow → whitelisted_ips, deny →
+ a persisted firewall block rule on the remote IP.
FR: Charge utile du verdict ask — autoriser/refuser un flux en
- attente. `remember` mémorise la décision pour la session."""
+ attente. La décision tient pour la session ; `permanent=True` écrit
+ en plus une politique durable : allow → whitelisted_ips, deny →
+ règle de blocage pare-feu persistée."""
remote_ip: str
remote_port: int
proto: str = "TCP"
allow: bool
+ permanent: bool = False
class PairingBody(BaseModel):
@@ -1878,7 +1883,7 @@ def _load_settings() -> None:
timeout=db.get_setting("ask_timeout", 15),
failopen=bool(db.get_setting("ask_failopen", False)))
if db.get_setting("ask_enabled", False):
- ok, why = ask_mode.start()
+ ok, why = ask_mode.start(exempt_ips=sorted(_whitelisted_ips))
if not ok:
logger.warning("ask mode unavailable: %s", why)
# EN: Local SLM enrichment — loopback-only by construction, opt-in.
@@ -2073,7 +2078,8 @@ async def post_settings(body: SettingsBody) -> dict:
# FR: Bascule à chaud du mode ask NFQUEUE — stop toujours sûr ;
# start rapporte honnêtement la disponibilité plateforme.
if value:
- ok, why = ask_mode.start()
+ ok, why = ask_mode.start(
+ exempt_ips=sorted(_whitelisted_ips))
if not ok:
logger.warning("ask mode unavailable: %s", why)
else:
@@ -3196,12 +3202,35 @@ async def ask_verdict(body: AskVerdictBody) -> dict:
remembers the decision for the session.
FR: Verdict pour un flux NFQUEUE en attente — le paquet est gelé
depuis l'alerte ASK_VERDICT ; `allow` l'accepte ou le droppe et
- mémorise la décision pour la session."""
+ mémorise la décision pour la session. `permanent` écrit en plus
+ une politique durable (whitelist ou règle pare-feu)."""
loop = asyncio.get_running_loop()
decided = await loop.run_in_executor(
None, ask_mode.decide, body.remote_ip, body.remote_port,
body.proto, body.allow)
+ persisted = None
+ if body.permanent:
+ if body.allow:
+ # EN: "Allow always" → durable whitelist entry for the IP.
+ # FR: « Autoriser toujours » → entrée whitelist durable.
+ _whitelisted_ips.add(body.remote_ip)
+ db.set_setting("whitelisted_ips",
+ sorted(_whitelisted_ips))
+ persisted = "whitelisted"
+ else:
+ # EN: "Deny always" → a REAL persisted firewall block rule.
+ # FR: « Bloquer définitivement » → vraie règle pare-feu.
+ try:
+ await loop.run_in_executor(
+ None, fw.add_rule, "ip", body.remote_ip, "block", 0)
+ rules, _lock = fw.serialized()
+ db.set_setting("firewall_rules", rules)
+ await broadcast({"type": "firewall", "rules": rules})
+ persisted = "firewall_rule"
+ except ValueError:
+ persisted = None
return {"ok": decided,
+ "persisted": persisted,
"note": "flow already timed out — OS policy applied"
if not decided else "verdict applied"}
diff --git a/backend/detection/askmode.py b/backend/detection/askmode.py
index 653bd40..8c5ef58 100644
--- a/backend/detection/askmode.py
+++ b/backend/detection/askmode.py
@@ -96,6 +96,12 @@ class AskMode:
self._decided: dict[tuple, bool] = {}
self._lock = threading.Lock()
self._rule_installed = False
+ # EN: IPs exempted from diversion at start (whitelist — "allow
+ # always" verdicts). Bounded; tracked for clean removal.
+ # FR: IPs exemptées du détournement au start (whitelist — verdicts
+ # « autoriser toujours »). Bornées ; suivies pour le retrait.
+ self._exempt: list[str] = []
+ self._exempt_rules: list[list[str]] = []
# ── lifecycle / cycle de vie ──────────────────────────────────────────
@@ -113,10 +119,15 @@ class AskMode:
if failopen is not None:
self._failopen = bool(failopen)
- def start(self) -> tuple[bool, str]:
+ def start(self, exempt_ips: Optional[list] = None) -> tuple[bool, str]:
+ """EN: `exempt_ips` get iptables RETURN rules before the NFQUEUE
+ jump so "allow always" verdicts survive restarts — bounded to 64.
+ FR: `exempt_ips` reçoivent des règles RETURN avant le saut NFQUEUE
+ — les verdicts « autoriser toujours » survivent au redémarrage."""
ok, why = available()
if not ok:
return False, why
+ self._exempt = list(exempt_ips or [])[:64]
import subprocess
from .nfqueue import NfqSocket # noqa: PLC0415
try:
@@ -149,6 +160,17 @@ class AskMode:
["iptables", "-w", "-I", "OUTPUT", "-j", "NFQUEUE",
"--queue-num", str(_QUEUE_NUM)],
]
+ # EN: Per-IP exemptions ride BEFORE the queue jump — they keep the
+ # LAN/UI exemption insertion order intact.
+ # FR: Les exemptions par IP précèdent le saut — l'ordre d'insertion
+ # des exemptions LAN/UI est préservé.
+ for ip in self._exempt:
+ cmds.insert(len(cmds) - 1,
+ ["iptables", "-w", "-I", "OUTPUT", "-d", ip,
+ "-j", "RETURN"])
+ self._exempt_rules.append(
+ ["iptables", "-w", "-D", "OUTPUT", "-d", ip, "-j",
+ "RETURN"])
for c in cmds:
try:
subprocess.run(c, timeout=10, check=False,
@@ -207,6 +229,10 @@ class AskMode:
subprocess.run(["iptables", "-w", "-D", "OUTPUT", "-j",
"NFQUEUE", "--queue-num", str(_QUEUE_NUM)],
timeout=10, check=False, capture_output=True)
+ for rm in self._exempt_rules:
+ subprocess.run(rm, timeout=10, check=False,
+ capture_output=True)
+ self._exempt_rules.clear()
self._rule_installed = False
# ── verdict path / chemin du verdict ─────────────────────────────────
diff --git a/backend/tests/test_v15_features.py b/backend/tests/test_v15_features.py
index 878e6a5..dc99113 100644
--- a/backend/tests/test_v15_features.py
+++ b/backend/tests/test_v15_features.py
@@ -815,3 +815,64 @@ def test_protomatch_ssh_and_ascii():
assert check(25, "TCP", b"\x16\x03\x01tls-on-smtp?") is not None
assert check(8443, "TCP", b"whatever") is None
assert check(0, "TCP", b"") is None
+
+
+# ── Permanent ask verdicts / Verdicts ask permanents ──────────────────────
+
+def test_askmode_exempt_ips_installed_and_removed(monkeypatch):
+ """EN: exempt_ips become `-d <ip> -j RETURN` rules inserted BEFORE the
+ NFQUEUE jump at start, and are individually deleted on stop — the
+ "allow always" path survives restarts without leaking rules.
+ FR: exempt_ips deviennent des règles `-d <ip> -j RETURN` insérées
+ AVANT le saut NFQUEUE au start, supprimées une à une au stop."""
+ import subprocess
+ from detection import askmode
+
+ calls = []
+ monkeypatch.setattr(askmode, "available", lambda: (True, ""))
+ monkeypatch.setattr(subprocess, "run",
+ lambda *a, **k: calls.append(a[0]) or None)
+
+ class FakeNfq:
+ def __init__(self, _q):
+ pass
+
+ def open(self):
+ pass
+
+ def bind_queue(self):
+ pass
+
+ def recv_packets(self, _t):
+ return []
+
+ def verdict(self, _pid, _accept):
+ pass
+
+ def close(self):
+ pass
+
+ monkeypatch.setattr("detection.nfqueue.NfqSocket", FakeNfq)
+ am = askmode.AskMode(lambda ctx: None)
+ ok, why = am.start(exempt_ips=["1.2.3.4", "5.6.7.8"])
+ assert ok, why
+ # EN: both exemptions inserted before the NFQUEUE jump
+ # FR: les deux exemptions insérées avant le saut NFQUEUE
+ q_idx = next(i for i, c in enumerate(calls) if "NFQUEUE" in c)
+ for ip in ("1.2.3.4", "5.6.7.8"):
+ ins = ["iptables", "-w", "-I", "OUTPUT", "-d", ip, "-j", "RETURN"]
+ assert ins in calls[:q_idx]
+ am.stop()
+ for ip in ("1.2.3.4", "5.6.7.8"):
+ assert ["iptables", "-w", "-D", "OUTPUT", "-d", ip, "-j",
+ "RETURN"] in calls
+
+
+def test_askmode_exempt_bounded():
+ """EN: exempt_ips is capped at 64 — a huge whitelist can't explode the
+ rule list. / FR: exempt_ips borné à 64 — une whitelist énorme ne peut
+ pas exploser la liste de règles."""
+ from detection.askmode import AskMode
+ am = AskMode(lambda ctx: None)
+ am._exempt = [f"10.0.0.{i}" for i in range(200)][:64]
+ assert len(am._exempt) == 64
diff --git a/backend/version.py b/backend/version.py
index a1ecb1f..0ccef3c 100644
--- a/backend/version.py
+++ b/backend/version.py
@@ -5,4 +5,4 @@ FR: Source unique de la version du backend (affichée dans /diagnostics).
À garder alignée avec electron/package.json et frontend/package.json.
"""
-__version__ = "1.5.2"
+__version__ = "1.5.3"
diff --git a/docs/FIREWALL.md b/docs/FIREWALL.md
index 211c23c..2ddc607 100644
--- a/docs/FIREWALL.md
+++ b/docs/FIREWALL.md
@@ -283,6 +283,11 @@ never ship data off the machine:
`python-netfilterqueue`: `detection/nfqueue.py` speaks
nfnetlink_queue over AF_NETLINK directly. Linux + root + iptables
only.
+- **Permanent ask verdicts** — the four classic choices exist:
+ allow once / deny once (session-scoped) and allow always /
+ deny always (`permanent=true` → the IP lands in `whitelisted_ips`
+ or a persisted firewall block rule, and whitelisted IPs get an
+ iptables RETURN exemption so they are never re-asked).
---
@@ -576,3 +581,8 @@ honnêtement et n'envoient jamais de données hors de la machine :
`python-netfilterqueue` : `detection/nfqueue.py` parle
nfnetlink_queue en AF_NETLINK directement. Linux + root + iptables
seulement.
+- **Verdicts ask permanents** — les quatre choix classiques existent :
+ autoriser / refuser une fois (portée session) et toujours autoriser /
+ toujours refuser (`permanent=true` → l'IP rejoint `whitelisted_ips`
+ ou une règle de blocage persistée, et les IP whitelistées reçoivent
+ une exemption iptables RETURN pour ne plus jamais être demandées).
diff --git a/electron/package.json b/electron/package.json
index 33f1fe0..30dbf31 100644
--- a/electron/package.json
+++ b/electron/package.json
@@ -1,6 +1,6 @@
{
"name": "snitch",
- "version": "1.5.2",
+ "version": "1.5.3",
"description": "Snitch \u2014 real-time network traffic visualizer / visualiseur de trafic r\u00e9seau en temps r\u00e9el",
"main": "main.js",
"license": "AGPL-3.0-or-later",
diff --git a/frontend/package.json b/frontend/package.json
index ab64fe9..6ba77e9 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "snitch-frontend",
- "version": "1.5.2",
+ "version": "1.5.3",
"private": true,
"license": "AGPL-3.0-or-later",
"description": "Snitch UI \u2014 React + D3.js / Interface React + D3.js",
diff --git a/frontend/src/components/AlertPanel.jsx b/frontend/src/components/AlertPanel.jsx
index 45b7975..4fa27e5 100644
--- a/frontend/src/components/AlertPanel.jsx
+++ b/frontend/src/components/AlertPanel.jsx
@@ -117,6 +117,20 @@ function AlertActions({ alert }) {
style={{ ...btn, color: '#ef4444', borderColor: '#ef444444' }}>
<ShieldX size={10} /> {t('alert_act_deny')}
</button>
+ <button onClick={() => post('/security/ask/verdict',
+ { remote_ip: d.remote_ip, remote_port: d.remote_port,
+ proto: d.proto, allow: true, permanent: true }, 'allow+')}
+ title={t('alert_act_allow_perm')}
+ style={{ ...btn, color: '#4ade80', borderColor: '#4ade8044' }}>
+ {t('alert_act_allow_perm')}
+ </button>
+ <button onClick={() => post('/security/ask/verdict',
+ { remote_ip: d.remote_ip, remote_port: d.remote_port,
+ proto: d.proto, allow: false, permanent: true }, 'deny+')}
+ title={t('alert_act_deny_perm')}
+ style={{ ...btn, color: '#ef4444', borderColor: '#ef444444' }}>
+ {t('alert_act_deny_perm')}
+ </button>
</>
)}
{d.ip && !alert._grouped && done !== 'block' && (
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 73fa5c5..f81979b 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -435,6 +435,8 @@ export default {
alert_act_suspend: 'Anhalten',
alert_act_allow: 'Erlauben',
alert_act_deny: 'Verweigern',
+ alert_act_allow_perm: 'Immer erlauben',
+ alert_act_deny_perm: 'Immer verweigern',
ar_action: 'Aktion',
ar_action_alert: 'Nur Alarm',
ar_action_block: 'Alarm + Block',
diff --git a/frontend/src/locales/en.js b/frontend/src/locales/en.js
index f3c95ee..db954d3 100644
--- a/frontend/src/locales/en.js
+++ b/frontend/src/locales/en.js
@@ -439,6 +439,8 @@ export default { // Navigation
alert_act_suspend: 'Suspend',
alert_act_allow: 'Allow',
alert_act_deny: 'Deny',
+ alert_act_allow_perm: 'Allow always',
+ alert_act_deny_perm: 'Deny always',
ar_action: 'Action',
ar_action_alert: 'Alert only',
ar_action_block: 'Alert + block',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 3104d50..784dc04 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -433,6 +433,8 @@ export default { // Navegación
alert_act_suspend: 'Suspender',
alert_act_allow: 'Permitir',
alert_act_deny: 'Denegar',
+ alert_act_allow_perm: 'Permitir siempre',
+ alert_act_deny_perm: 'Denegar siempre',
ar_action: 'Acción',
ar_action_alert: 'Solo alerta',
ar_action_block: 'Alerta + bloqueo',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 317205e..8ebb49c 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -435,6 +435,8 @@ export default { // Navigation
alert_act_suspend: 'Suspendre',
alert_act_allow: 'Autoriser',
alert_act_deny: 'Refuser',
+ alert_act_allow_perm: 'Toujours autoriser',
+ alert_act_deny_perm: 'Toujours refuser',
ar_action: 'Action',
ar_action_alert: 'Alerte seule',
ar_action_block: 'Alerte + blocage',
diff --git a/frontend/src/locales/ja.js b/frontend/src/locales/ja.js
index 96021c4..e24c049 100644
--- a/frontend/src/locales/ja.js
+++ b/frontend/src/locales/ja.js
@@ -435,6 +435,8 @@ export default {
alert_act_suspend: '一時停止',
alert_act_allow: '許可',
alert_act_deny: '拒否',
+ alert_act_allow_perm: '常に許可',
+ alert_act_deny_perm: '常に拒否',
ar_action: 'アクション',
ar_action_alert: 'アラートのみ',
ar_action_block: 'アラート+ブロック',
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index fe3ae12..625f625 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -435,6 +435,8 @@ export default {
alert_act_suspend: 'Suspender',
alert_act_allow: 'Permitir',
alert_act_deny: 'Negar',
+ alert_act_allow_perm: 'Permitir sempre',
+ alert_act_deny_perm: 'Negar sempre',
ar_action: 'Ação',
ar_action_alert: 'Só alerta',
ar_action_block: 'Alerta + bloqueio',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index a873004..7b59ff3 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -435,6 +435,8 @@ export default {
alert_act_suspend: 'Приостановить',
alert_act_allow: 'Разрешить',
alert_act_deny: 'Запретить',
+ alert_act_allow_perm: 'Всегда разрешать',
+ alert_act_deny_perm: 'Всегда запрещать',
ar_action: 'Действие',
ar_action_alert: 'Только алерт',
ar_action_block: 'Алерт + блок',
diff --git a/frontend/src/locales/zh-CN.js b/frontend/src/locales/zh-CN.js
index 9cd74a5..ea92c69 100644
--- a/frontend/src/locales/zh-CN.js
+++ b/frontend/src/locales/zh-CN.js
@@ -435,6 +435,8 @@ export default {
alert_act_suspend: '挂起',
alert_act_allow: '允许',
alert_act_deny: '拒绝',
+ alert_act_allow_perm: '始终允许',
+ alert_act_deny_perm: '始终拒绝',
ar_action: '动作',
ar_action_alert: '仅告警',
ar_action_block: '告警+封锁',