Skip to content

fix(esign): refuse uploaded signatures that also add annotations - #78

Merged
lorenzocorallo merged 3 commits into
mainfrom
fix/esign-upload-integrity
Oct 17, 2026
Merged

lorenzocorallo merged 3 commits into
mainfrom
fix/esign-upload-integrity

Conversation

@lorenzocorallo

@lorenzocorallo lorenzocorallo commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Uploaded PDFs could append an annotation that changes the document while adding a valid signature. The initial fix still accepted unrelated widgets whose signature value merely contained /ByteRange.

PDF inspection now records the new signature's field and value references on the server. After cryptographic verification, upload validation accepts only that exact field and its owned widgets. Dummy signature values, unrelated widgets that reuse the verified value or parent, additional non-signature fields, annotation actions, and XFA changes are rejected before saving a version or recording a signature. Separate field/widget layouts and existing empty signature fields remain supported.

Validation:

  • Two service regressions cover dummy widgets both outside and inside the form. Both fail against the previous PR code because the upload is accepted; both pass with this fix and verify that rejected uploads leave document and signer state unchanged.
  • Nine structural validation tests cover first/second signatures, empty fields, separate widgets, unrelated aliases, additional child fields, annotations, actions, and form changes.
  • The fallback service test completes two successive legitimate uploads.
  • Typecheck, Biome, and build pass.
  • Offline Node test suite: 143 passed, 8 optional tests skipped. A scratch-only Nodemailer account fixture prevents router tests from contacting the external development-mail service. Source and dependencies were mounted read-only; execution used a network-disabled container with bounded resources and temporary writes.

The change applies to external uploads. The approved signature retains its existing appearance behavior and placement rules.

The upload fallback compared old objects only: new objects were skipped and
page /Annots only had to keep its old prefix. A signer could add any
annotation (free text or a stamp drawn over the page, a link, a script) in
the revision they sign with their own valid CIE, and the changed document
was accepted and sent on to the other signers and recipients.

Every annotation appended to a page, and every field appended to the form,
must now be a signature widget or field with no actions and a new signature
value. The form dictionary itself is compared wherever it lives, so a form
held in the catalog can't gain /XFA either. Filling an existing empty
signature field must also set a new signature value.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 09485b8d-3720-4f13-9985-58cb16169142
📥 Commits

Reviewing files that changed from the base of the PR and between 501a7ec and 9a9ab23.

📒 Files selected for processing: 6
  • src/esign/pdf/diff.ts
  • src/esign/pdf/inspect.ts
  • src/esign/service.ts
  • tests/esign-diff.test.ts
  • tests/esign-fixtures.ts
  • tests/esign-service.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Carry the verified signature field and value references from PDF inspection into upload validation. Accept only that field and its owned widgets, including separate widget children; reject dummy values, unrelated aliases and extra child fields before committing a version.
@lorenzocorallo
lorenzocorallo merged commit 6a0b866 into main Oct 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant