Skip to content

fix(n8n): discover signed PDF via authorized WebDAV PROPFIND - #158

Merged
vitormattos merged 1 commit into
mainfrom
fix/n8n-automatic-signed-dav-20261111
Nov 12, 2026
Merged

vitormattos merged 1 commit into
mainfrom
fix/n8n-automatic-signed-dav-20261111

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Purpose

Remove the manually supplied signedPdfPath from the single-document external signer example introduced in #149. Keep public OCS + authorized Nextcloud WebDAV interfaces; do not invent LibreSign endpoints or infer signed filenames.

Verified flow

After authorized OCS /file/list reports status 3 for the precise file ID/UUID:

  1. PROPFIND Depth: 1 the integration account's default LibreSign/ DAV folder (same HTTPS origin and HTTP Basic App Password).
  2. Check a bounded set of immediate request folders, then PROPFIND each folder for oc:fileid, MIME type and byte length.
  3. Locate exactly one original PDF by correlating the OCS nodeId with DAV oc:fileid; require exactly one other nonempty PDF sibling, using the literal authorized DAV href returned by Nextcloud (no filename construction).
  4. Download that PDF with the same credential; retain separate cryptographic validation (cryptographicSignatureVerified: false until an external verifier runs).

The workflow rejects missing/ambiguous matches, path traversal, absent node IDs, denied permissions and scans exceeding maxSearchFolders (default 50, maximum 250). It is intentionally scoped to one document / one email signer and default LibreSign storage; not a generic envelope resolver.

Evidence

  • node --test examples/n8n/test-workflow.mjs: 12/12 passed, including wrong source ID, missing signature, ambiguous sibling and path traversal.
  • git diff --check: clean.
  • Imported the exact proposed 21-node workflow in n8n 2.47.3 in a disposable Nextcloud 35.0.2 + LibreSign 15.0.12 + Mailpit stack; test-only continuation of an already signed synthetic request completed 17 executed nodes, all successful, including both PROPFINDs and authenticated GET; 47,799 PDF bytes recovered. No repeat creation/invitation POSTs. Previous browser signing was independently checked with pdfsig (signature valid, private test CA not trusted globally).
  • .github/workflows/docs.yml now runs Node regression tests and a real n8n 2.47.3 import smoke check for future changes.

Limitations and release parity

  • The automated WebDAV resolution was exercised only on LibreSign 15.0.12; 13, 14 and development still require release-specific runtime verification. This is not proof of a single uninterrupted automated creation-to-signature run.
  • Custom storage, envelope/multi-signer flows, multiple candidate PDFs, or too many user folders abort safely. Do not enable automatic retries of POST create/invite. SMTP acceptance remains distinct from delivery confirmation.
  • The sample does not verify the PDF's signature chain; use a trusted verifier separately.

Signed commit with DCO. No production server changes, deployment or merge requested by this PR description.

After OCS confirms a single-document signature, list the requester's
LibreSign folder with authenticated PROPFIND, locate the original source
by its Nextcloud nodeId/oc:fileid, and require one unambiguous PDF sibling
before downloading by the actual DAV href. Abort safely on missing or
ambiguous permissions/files. Add Code-node regression coverage and pin
n8n 2.47.3 import validation in documentation CI.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1-4-g2a6da11

QR code for preview link

🚀 View preview at
https://libresign.github.io/site-preview/docs-preview/pr-158/

Built to branch gh-pages at 2026-11-11 23:09 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Documentation: All versions · LibreSign 16 development manual · Review notes

Preview is separate from production. LibreSign 16 has not been released; the development manual describes the upcoming version.

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