pdfcraft/crates
Thorsten Hirsch c957288d3b
M9: read BER signatures (DocuSign, Documenso); classify later changes narrowly (#144)
* M9: read BER signatures; later changes are classified narrowly

Real-world signatures (DocuSign, Telekom QES, Documenso) are BER: indefinite
lengths and segmented OCTET STRINGs, which the strict DER reader turned away
("DER signature wrong"). Behind that, later revisions that add DSS data or
rewrite the XMP were classified as tampering.

- cms: the CMS structure is read with `Tlv::parse_ber` (the reader #453 added
  for PKCS#12); certificates and signed attributes are still verified over
  their own exact bytes, signed attributes with an indefinite length are
  re-encoded as DER first (RFC 5652 §5.4), and the details say the signature
  was BER. High tag numbers are not read.
- pdf: validation data added after signing is a permitted change, but only
  objects reached through /DSS /Certs|CRLs|OCSPs|VRI by the keys the standard
  defines, with the shape of their role, and new or only grown since signing.
  A /DSS entry naming other objects (a page's contents) excuses nothing.
- pdf: only the signed catalog's /Metadata is the document's XMP. A
  /Type /Metadata or /Type /DSS label on any other dictionary or stream, even
  one it already had when signed (a page's Form XObject), makes nothing
  permitted. Negative tests at every DocMDP level.

Six of the new tests fail on the previous code: the BER signature, nested
segments, the store-growth rules, and a dictionary or stream carrying a
/Type /Metadata or /Type /DSS label. The last one let a drawn Form XObject be
rewritten under a Valid signature.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* M9: comparing a grown document security store is linear for references and bounded otherwise

only_grew compared arrays element by element, so a crafted /Certs of ~100k entries could hang
validation. Reference arrays are compared as sets; other arrays only up to 10,000 elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-09 18:43:21 -04:00
..
a11y Add image signatures with placement preview and resize controls (#335) 2026-10-08 16:36:26 -04:00
annot Refs #169: no form bar for push-button-only documents; Screen is not a comment (#615) 2026-10-09 17:49:54 -04:00
automation Refs #103: ship the OCR models in the desktop release packages (#630) 2026-10-09 18:42:23 -04:00
compare Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
content Fix #155: edit text across content stream pieces (#628) 2026-10-09 17:57:02 -04:00
cos Refs #142: decode outline titles with BOMs and raw UTF-8 consistently (#614) 2026-10-09 16:52:07 -04:00
create M10.2: Create PDF from multiple files, edited as pages in the Organize grid (#361) 2026-10-08 17:42:13 -04:00
crypt Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
edit Export to Word/HTML/RTF: read text and images drawn by form XObjects (fixes #314) (#406) 2026-10-09 18:22:07 -04:00
engine Export to Word/HTML/RTF: read text and images drawn by form XObjects (fixes #314) (#406) 2026-10-09 18:22:07 -04:00
export Fix #526: keep text colour in Word, HTML and RTF export (#547) 2026-10-09 10:49:21 -04:00
filters Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
fonts Issue #125: page text the standard fonts can't draw is refused, not written as ? (#510) 2026-10-09 13:20:47 -04:00
forms Fix main CI: drop four duplicate copies of the forms redraw tests (#605) 2026-10-09 15:42:10 -04:00
geom Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
js XFA: run FormCalc scripts (#301) 2026-10-08 13:06:33 -04:00
measure M5: draw all ten PDF line-ending styles (#520) 2026-10-09 13:15:44 -04:00
model Phone photos follow EXIF orientation; image signatures stay upright on rotated pages (#434) (#485) 2026-10-09 09:14:55 -04:00
ocr Refs #103: ship the OCR models in the desktop release packages (#630) 2026-10-09 18:42:23 -04:00
optimize M11: Optimize PDF and Reduce File Size run in the background with a progress bar (#370) 2026-10-08 18:46:34 -04:00
organize M2: bound page-label traversal and output (#480) 2026-10-09 14:12:16 -04:00
platform Platform: one save-staging helper for automation and the desktop app (#356) 2026-10-08 17:07:00 -04:00
preflight Rename PrintCraft to PdfCraft (#174) 2026-10-07 16:03:57 -04:00
print M10: Print ▸ Properties… opens the printer driver's own settings (#482) 2026-10-09 14:27:02 -04:00
redact Fix #155: edit text across content stream pieces (#628) 2026-10-09 17:57:02 -04:00
render Refs #169: no form bar for push-button-only documents; Screen is not a comment (#615) 2026-10-09 17:49:54 -04:00
sign M9: read BER signatures (DocuSign, Documenso); classify later changes narrowly (#144) 2026-10-09 18:43:21 -04:00
ui-egui Refs #103: ship the OCR models in the desktop release packages (#630) 2026-10-09 18:42:23 -04:00
xfa XFA: choice lists, signature, password, image and barcode fields; PNG and GIF pictures (#414) 2026-10-09 14:46:07 -04:00
xfdf M6.2: check boxes with non-UTF-8 state names show their mark when clicked (#536) 2026-10-09 12:58:38 -04:00