fix(9.18): close pii outbound gaps

Restore case-number, name-patronymic, and social-id detection in pii_gate.
Route outbound search/name text through pii_gate before external calls.
Keep money and legal-reference false-positive axes quiet.
This commit is contained in:
Зарубин Филипп
2026-08-20 21:41:08 +03:00
parent 7a95170d63
commit df15df9898
4 changed files with 85 additions and 8 deletions
+8
View File
@@ -65,6 +65,11 @@ import time
from datetime import date, datetime
from html.parser import HTMLParser
SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
if SCRIPTS_DIR not in sys.path:
sys.path.insert(0, SCRIPTS_DIR)
import pii_gate # noqa: E402
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
KODEKSY_DIR = os.path.join(ROOT, "knowledge", "kodeksy")
PLENUMY_DIR = os.path.join(ROOT, "knowledge", "plenumy")
@@ -191,6 +196,9 @@ def http_get(url: str, cache_key: str) -> bytes | None:
report_failures() возвращал 0, а legal-corpus-monthly.sh писал в лог
«обновлено 0, ошибок 0» и завершался нулём.
"""
if pii_gate.residual_matches(url):
FAILURES.append(f"{url}: URL похож на персональные данные — наружу не отправлен")
return None
cache_path = os.path.join(CACHE_DIR, cache_key)
if (CACHE_MAX_AGE > 0 and os.path.exists(cache_path)
and os.path.getsize(cache_path) > 200