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 WFP method shadowing + eBPF test patch target

MoneyLisa35f8a79c0600
diff --git a/backend/detection/firewall.py b/backend/detection/firewall.py
index e090091..6a1ed8f 100644
--- a/backend/detection/firewall.py
+++ b/backend/detection/firewall.py
@@ -465,7 +465,7 @@ class FirewallManager:
# ── Windows WFP backend / Backend WFP Windows ────────────────────────────
- def _wfp(self):
+ def _wfp_engine(self):
"""EN: Lazy engine open — returns the backend, False when unavailable
(non-Windows, missing admin, absent dll), and remembers the verdict.
FR: Ouverture paresseuse du moteur — renvoie le backend, False si
@@ -509,7 +509,7 @@ class FirewallManager:
WFP can't serve this rule — the caller then falls back to netsh.
FR: Applique via WFP. Renvoie (ok, err) ou (None, raison) quand
WFP ne peut pas servir — l'appelant replie alors sur netsh."""
- wfp = self._wfp()
+ wfp = self._wfp_engine()
if wfp is None:
return None, "wfp unavailable"
if kind == "process":
@@ -529,7 +529,7 @@ class FirewallManager:
deterministic, unknown ones are simply absent.
FR: Supprime tous les filtres WFP créés par la règle — les clés
sont déterministes, les absentes ignorées."""
- wfp = self._wfp()
+ wfp = self._wfp_engine()
if wfp is None:
return
from detection.wfp import WfpBackend
@@ -743,7 +743,7 @@ class FirewallManager:
"-j", "DROP", "-m", "comment",
"--comment", f"snitch-{rid}"])
elif self._platform == "windows":
- if self._wfp() is not None:
+ if self._wfp_engine() is not None:
# EN: True delta — per-IP keys mean stale addresses
# are deleted and new ones added atomically.
# FR: Vrai delta — les clés par IP suppriment les
@@ -752,7 +752,7 @@ class FirewallManager:
"id": r["id"], "kind": "domain",
"value": r["value"], "resolved": old})
for t in sorted(set(new) - set(old)):
- self._wfp().add_block(
+ self._wfp_engine().add_block(
r["id"], [{"remote": t}])
else:
# EN: netsh rules are name-keyed, not value-keyed —
diff --git a/backend/tests/test_v15_features.py b/backend/tests/test_v15_features.py
index 1991eda..0aa1f68 100644
--- a/backend/tests/test_v15_features.py
+++ b/backend/tests/test_v15_features.py
@@ -641,7 +641,11 @@ def test_ebpf_enforce_scoped_attach(monkeypatch):
monkeypatch.setitem(__import__("sys").modules, "bcc",
type("B", (), {"BPF": FakeBPF}))
monkeypatch.setattr(m, "available", lambda: (True, ""))
- monkeypatch.setattr(m._CGROUP_DIR, "mkdir", lambda **kw: None)
+ # EN: PosixPath instances are slot-based — mkdir must be patched on
+ # the CLASS, not the instance (read-only attr on Python ≤3.12).
+ # FR: les PosixPath sont à slots — mkdir se patche sur la CLASSE.
+ monkeypatch.setattr(type(m._CGROUP_DIR), "mkdir",
+ lambda self, **kw: None)
e = m.EbpfEnforcer()
ok, why = e.start()
assert ok, why