docs: PDF import hardening analysis (BLK-009) — byte-scan reader and object-stream-free export now, worker and parser replacement before external users

This commit is contained in:
bchanot committed 2026-10-11 16:12:22 +02:00
1 parent 293a6e0b36
commit 5ed4a4b620
3 files changed
+96 -1

No files matched your search

+1 -1
View File
@@ -80,4 +80,4 @@ Status: open (no real data yet; treat before Step 7+ persistence of user reports
## BLK-009 | 2026-10-11 | pdf-lib inflates PDF object streams without cap at `PDFDocument.load` (import path)
Security audit Step 6 (MEDIUM, pre-existing since Step 1 import): `PDFDocument.load` decodes every `/ObjStm` and xref stream eagerly with its own uncapped FlateStream; measured 408 KB PDF → 400 MB in 1.4 s, 468 MB RSS; `MAX_PDF_BYTES` 50 MiB allows ~50 GB. Attachment cap (16 MiB) covers the attachment only. Impact: tab freeze/OOM for the practitioner on a crafted PDF, no code execution. Cannot refuse `/ObjStm` (pdf-lib `save()` emits object streams in our own PDFs). Options: parse in a Web Worker (bounded blast radius), or locate the attachment by scanning bytes without a full load, or a capped custom decoder. pdf-lib 1.17.1 unmaintained since 2021 (LOW in the same audit).
Status: open (documented in docs/PDF-FORMAT.md "Known limits"); candidate for Step 14 worker or a hardening task before external users.
Status: open; analysis + plan in docs/development/PDF_IMPORT_HARDENING.md (2026-10-11): byte-scan reader (no pdf-lib load on import) + `useObjectStreams: false` at export can land now; worker/server import + pdf-lib replacement are prerequisites before external users.