There is an error with ssh node in newest version

There is an error about character, or something to read ssh command with speacial characters.

At first, I think that is an error from command syntax. But it is run normally when I try to run command from ssh directly.

  • So, it just has error when run through ssh node
  • It is ok at old versions

This is command:

sudo wp post meta update 12345 name_of_key '<script>window.location.replace("https://sub.mydomain.com/t/content-id-1-2-6-2022-1456/2768");</script>' --user=test --path=/path/to/myhosting --url=https://mydomain.com --allow-root

This is error from ssh node:

ERROR: Expression is not valid: window is not allowed [Error in parameter: "command"]

Error: Expression is not valid: window is not allowed [Error in parameter: "command"]
    at Expression.resolveSimpleParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Expression.js:92:19)
    at Expression.getParameterValue (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Expression.js:135:25)
    at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/NodeExecuteFunctions.js:904:42)
    at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/NodeExecuteFunctions.js:1124:24)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Ssh/Ssh.node.js:304:50)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:592:28)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:455:49

Could you check this, please?

Hi @cmdntd987, this is intended I am afraid. It was introduced as an effort to prevent cross-site scripting:

I suppose it would be nice to have this configurable (for example through an environment variable), so you might want to raise a feature request for this.

Could you help me know how to config to fix this?
Anyway, it is like a bug, not like any feature. So I do not know how to call this if creating any feature request.

It was intended but some cases like yours were overlooked. A fix for this is already in progress.

Temporary you can do something like that:

sudo wp post meta update 12345 name_of_key '<script>{{ 'window' }}.location.replace("https://sub.mydomain.com/t/content-id-1-2-6-2022-1456/2768");</script>' --user=test --path=/path/to/myhosting --url=https://mydomain.com --allow-root
2 Likes

It is really worked!
Thank you very much. Hope for your next repo!

1 Like

Great to hear, you are welcome. Have fun!

Got released with [email protected]

2 Likes