Repository navigation
fix(docmdp): accept DSS and document timestamp updates after certification - #9556
Conversation
…ation ISO 32000-2 12.8.2.2.1 and ETSI EN 319 142-1 5.4 exempt incremental updates that only add a DSS dictionary (VRI, Certs, CRLs, OCSPs) or a document timestamp from DocMDP restrictions. The validation classified such an update as an unknown modification, so a certified document became invalid as soon as long-term validation data was added, at every DocMDP level. Before classifying the modification, parse the bytes after the certified revision strictly as incremental updates: indirect objects, a classic xref table listing exactly those objects at their offsets, a trailer whose /Root, /Info and /Prev match the certified revision and has no /Encrypt, and startxref. Xref streams, unlisted or unparsable bytes and object streams mean the update is not validation data only. The certified revision is read through its classic xref tables. New objects must use numbers from the certified /Size on. Of the existing objects, an update may only rewrite the catalog (/DSS, /Extensions, /Version), the AcroForm (/SigFlags, timestamp fields appended to /Fields), a page (timestamp fields appended to /Annots) and the information dictionary (/ModDate, /Producer). A new field must be an invisible document timestamp field (zero-area /Rect, no /Kids, /Parent, /A or /AA) whose value is a new /DocTimeStamp with /SubFilter /ETSI.RFC3161; any other new signature, field or annotation keeps the update a violation. Rewritten objects are compared in a canonical form (sorted keys, names with #xx escapes decoded, strings by their bytes, duplicate keys rejected, bounded nesting), since LTV tools rewrite the catalog and the information dictionary with their own formatting. Signed-off-by: no84by <50858621+no84by@users.noreply.github.com>
|
Hi! The dependency updates are now fully merged and available on LibreSign's
Could you please rebase this PR onto the latest In particular:
The required dependency APIs are already available under the The goal is to keep the functional improvements and security regression coverage from your contribution while delegating structural PDF inspection to the shared library. Thanks! |
vitormattos
left a comment
There was a problem hiding this comment.
Requesting changes before merge. The required validator v0.6.1 and scoped 3rdparty update are now merged into LibreSign's main, but this PR still duplicates security-sensitive PDF revision parsing and needs to be rebased and adapted to the shared APIs.
Please address the concrete items in the maintainer comment: use DocMdpValidationDataInspector, rely on the active signature inventory, preserve P=1/P=2/P=3 semantics and regression coverage, coordinate with #9667, and rerun CI after resolving conflicts. We can re-review the updated implementation once these changes are available.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
|
/backport to stable35 |
|
/backport to stable34 |
|
/backport to stable33 |
The active-signature inventory implementation is already on main via #9556. Remove the superseded revision-count shortcut and cover orphan-only and mixed active-certification scenarios with real incremental revisions. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Resolves #9534
Part of #8946
Related: #9667 (separate PR)
Summary
ISO 32000-2 §12.8.2.2.1 and ETSI EN 319 142-1 allow validation-only incremental updates (DSS/VRI, certificates, CRLs, OCSP responses and document timestamps) after PDF certification. LibreSign previously reported these updates as DocMDP violations, including at P=1.
This change recognizes validation-only revisions at DocMDP P=1, P=2 and P=3 without allowing unrelated changes to page content, forms, annotations or document structure.
Implementation
DocMdpValidationDataInspector::hasOnlyValidationDataUpdates()frompdf-signature-validatorv0.6.1 rather than maintaining a duplicate PDF revision parser inDocMdpHandler.PdfSignatureInventoryReaderto locate the active certification signature, determine its signed revision boundary and exclude orphaned signature dictionaries from conclusive revision counts. Retain the legacy fallback when inventory parsing is inconclusive.CI follow-up fixes
The branch also includes two narrowly scoped fixes for failures exposed while validating the PR:
WorkerStarterTest: wait for the worker's completion marker content, not merely the existence of its file.These changes are separate from the DocMDP logic and are visible in the diff.
How to test
Validation
DocMdpHandlerTest: 81 tests, 153 assertions passed locally on PHP 8.3, 8.4 and 8.5.DocMdpHandlerValidationDataTestincludes native-engine integration and negative regression scenarios.355c21c, including PHPUnit, Behat and Playwright (verified 2026-11-23). Consult the live checks for subsequent commits.The original contributor commit and authorship are preserved. Follow-up commits are cryptographically signed and DCO-compliant; no rebase or force-push was used. Parts of the implementation were developed with AI assistance.
Maintainer review and final merge remain human decisions.