From e111522415c21ca8ef47f0d8be48c95bd8ab8c69 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Thu, 11 Jun 2026 00:51:10 +0200 Subject: [PATCH] feat(accounting): rasterise inbound PDFs server-side (never serve raw to browser) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Security hardening for inbound supplier-invoice previews. The admin UI no longer renders raw PDFs — a malicious inbound PDF could otherwise run embedded JS or phone home in the admin's session. Instead PDFs are rasterised to flat PNGs server-side and only those images are shown. - backend: new rasterizeService shells out to poppler `pdftoppm` (added to the Docker image via apk poppler-utils — an OS package, NOT a Node PDF lib, so it respects the pdfkit+pdf-lib "no third PDF lib" rule). pdftoppm executes no JS and fetches no remote resources, so it doubles as the SSRF/phone-home guard. Rendered pages cached under storage/business-docs/inbound/rendered//. - GET /inbound/:id/page/:n streams the rasterised PNG (CSP default-src 'none' + nosniff). GET /inbound/:id/file now serves PDFs as a DOWNLOAD only (Content-Disposition: attachment) — never inline; images still inline. - frontend: triage preview switched from a raw-PDF