|
|
cf78bea910
|
feat(q1): F+sécurité — rescan inconditionnel + hardening quarantine
Suite des étapes Q-1 (F = rescan résiduel) + apport sécurité par Qwen
review Codex gpt-5.5 5 rounds (verdict READY FOR MERGE).
## anonymizer_core_refactored_onnx.py
- M5 Rescan résiduel inconditionnel : NIR/EMAIL/IBAN/TEL recherchés après
TOUT nettoyage. Fail-closed — aucun output livré si > seuil
(SEUIL_RESCAN_RESIDUEL = 0)
- M3 Return structuré : process_pdf retourne maintenant
{"status": "quarantined", "reason": ..., "text": "", "audit": ""} au lieu
de {} sur quarantaine — callers compatibles avec outputs["text"]/"audit"
- C3+M2 fallback préflight : si quarantine_mgr absent ET préflight rate,
copie du PDF source dans out_dir/_preflight_failed/ avec chmod 0o700
(le document n'est jamais perdu silencieusement)
- S5 guard double raster : "pdf_raster" not in outputs avant fallback
- Retrait import DocLogger (mort, jamais branché)
## quarantine.py
- _sanitize_doc_name() — anti path-traversal sur le nom de doc
- _escape_markdown_table_cell() — anti injection markdown dans INDEX.md
- _secure_quarantine_dir() — mkdir + chmod(0o700) systématique
- _append_errors_log() durci :
os.open(O_CREAT|O_APPEND|O_WRONLY|O_NOFOLLOW, 0o600)
+ fcntl.flock(LOCK_EX) + os.fchmod
- Retrait DocLogger (code mort identifié en review)
- Retrait REASON_CODES (jamais utilisé)
## Limites connues
- QuarantineManager pas encore wired dans GUI/server.py — les callers
actuels marchent en fallback (quarantine_mgr=None)
- finalize() + ProcessPoolExecutor : entries worker-local ne mergent pas
automatiquement (à documenter)
## Validation
- 73 tests unit existants : OK (non-régression)
- 1 test Q-1 happy path : passe (dégelé dans commit suivant)
- Codex gpt-5.5 5 rounds review : READY FOR MERGE
Co-Authored-By: Qwen Code <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-06-02 10:44:52 +02:00 |
|
|
|
7fc97aa11f
|
feat(q1): add quarantine.py module — entries, manager, logger
Module standalone pour la quarantaine différentielle Q-1 :
- QuarantineEntry dataclass (doc_name, reason, detail, severity, flags...)
- QuarantineManager (flag, has_full_quarantine, finalize, INDEX.md gen)
- DocLogger (B-2 logs par doc, append-only)
- Constantes SEUIL_TEXTE_MINI=100, SEUIL_RESCAN_RESIDUEL=0
Smoke test OK : 2 entrées (full + partial), INDEX.md, errors.log,
reason.txt générés conformes spec §6 du consolidé v2.
Ref: docs/coordination/inbox/for-dom/2026-05-29_consolide_pseudocode-Q1-v2.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-29 17:58:46 +02:00 |
|