T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:75- Finding
Plaintext Copies of Sensitive Financial Documents Are Written Beside Source Files
- Content
View full analysis
.md`).""" return Path(str(pdf_path) + ".md") def _write_transcription(pdf_path, text): """Écrit `.md` : la transcription texte brute du PDF (pdftotext/OCR), pour relecture humaine. Idempotent (n'écrase pas si déjà présent). La source de vérité reste le PDF — ce `.md` est une aide à la consultation.""" md = _md_path(pdf_path) if md.exists(): return try: body = text.strip() or "(aucun texte extractible — PDF scanné/photo, voir l'image source)" md.write_text( f"# Transcription — {Path(pdf_path).name}\n\n" f"> Texte brut extrait par `extract.pdftext()` (pdftotext `-layout` / OCR tesseract).\n" f"> Aide à la relecture ; la source de vérité reste le PDF.\n\n" f"```text\n{body}\n```\n", encoding="utf-8") except OSError: pass ``` The extraction result and raw text are also persisted in an adjacent cache: ```python if stamp is not None: try: save_json(_cache_path(pdf_path), {"_stamp": stamp, "fields": g, "text": text}) except OSError: pass ``` ### Technical Analysis Every processed invoice, expense receipt, or bank statement can produce two files adjacent to the original document: - `.md`, containing the raw OCR or PDF text. - `.extract.json`, containing extracted fields and the raw text. These files may include bank account identifiers, transaction histories, customer and employee identities, addresses, invoice references, and financial amounts. The files are written without explicitly applying restrictive permissions. Their effective permissions ...[truncated 2051 chars]- Remediation
View remediation
