From 9d22c7a2782a1908f81bcf80260cd91cb296e239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 19 Dec 2023 15:20:29 +0100 Subject: [PATCH] feat(editor): Gracefully ignore invalid payloads in postMessage handler (#8096) It's possible for browser extensions to send `message` events to an n8n window. This change improves the already existing check to ignore invalid messages. Fixes https://community.n8n.io/t/errors-in-the-browser-console-on-n8n-1-version/33910 --- packages/editor-ui/src/views/NodeView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 505ad3a149c51..0fccc52dc1231 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -4351,7 +4351,7 @@ export default defineComponent({ } }, async onPostMessageReceived(message: MessageEvent) { - if (!message?.data?.includes?.('"command"')) { + if (!message || typeof message.data !== 'string' || !message.data?.includes?.('"command"')) { return; } try {