Skip to content

fix(n8n): validate Nextcloud origin in the n8n Code runtime - #150

Merged
vitormattos merged 1 commit into
mainfrom
fix/n8n-code-node-url-parser-20261111
Nov 11, 2026
Merged

vitormattos merged 1 commit into
mainfrom
fix/n8n-code-node-url-parser-20261111

Conversation

@vitormattos

Copy link
Copy Markdown
Member

Context

Follow-up to #149, discovered by importing and executing the workflow in actual n8n 2.47.3.

Reproduced failure

Prepare request throws ReferenceError: URL is not defined because n8n Code's sandbox does not provide the global URL constructor. The original Node VM tests supplied URL explicitly and missed this runtime restriction.

Fix

  • Validate HTTPS origin (host, optional port) without using URL.
  • Add a regression test running the Code node script with URL: undefined and negative cases for credentials in URL, paths, query and malformed port.
  • No credentials, callbacks, LibreSign endpoints or workflows added.

Verification

  • Pre-fix: 7 tests passed, 1 new regression failed.
  • Post-fix: node --test examples/n8n/test-workflow.mjs: 8 passed, 0 failed.
  • Import of original JSON in n8n 2.47.3 succeeded; actual CLI execution failed at Prepare request with URL is not defined.
  • Import of patched JSON in same n8n 2.47.3 succeeded; execution reached Create request, where it stopped at the expected Credentials not found boundary before test credentials were configured.

Full LibreSign signing/SMTP/WebDAV E2E is not asserted by these checks. Keep this PR separate and do not merge automatically.

Use n8n-compatible JavaScript in the Code node and cover the missing URL
constructor with a dedicated regression test.

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

github-actions Bot commented Nov 11, 2026 •

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-150/

Built to branch gh-pages at 2026-11-11 21:58 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.

@vitormattos
vitormattos marked this pull request as ready for review November 11, 2026 21:57
@vitormattos
vitormattos merged commit cec26f5 into main Nov 11, 2026
4 checks passed
@vitormattos
vitormattos deleted the fix/n8n-code-node-url-parser-20261111 branch November 11, 2026 21:57
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