From 0db98f7fb1d1a89fda41a911cfe2eb52ff1ff670 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 9 Feb 2024 10:35:58 +0100 Subject: [PATCH] Move sandbox escape test to server --- packages/server/src/jsRunner/tests/jsRunner.spec.ts | 7 +++++++ packages/string-templates/test/javascript.spec.js | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/server/src/jsRunner/tests/jsRunner.spec.ts b/packages/server/src/jsRunner/tests/jsRunner.spec.ts index cddab3c9b4..04b323cf80 100644 --- a/packages/server/src/jsRunner/tests/jsRunner.spec.ts +++ b/packages/server/src/jsRunner/tests/jsRunner.spec.ts @@ -47,6 +47,13 @@ describe("jsRunner", () => { expect(output).toBe(3) }) + it("should prevent sandbox escape", async () => { + const output = await processJS( + `return this.constructor.constructor("return process")()` + ) + expect(output).toBe("Error while executing JS") + }) + describe("helpers", () => { runJsHelpersTests({ funcWrap: (func: any) => config.doInContext(config.getAppId(), func), diff --git a/packages/string-templates/test/javascript.spec.js b/packages/string-templates/test/javascript.spec.js index 9a68f7eb1e..851b2ced30 100644 --- a/packages/string-templates/test/javascript.spec.js +++ b/packages/string-templates/test/javascript.spec.js @@ -142,13 +142,6 @@ describe("Javascript", () => { const output = processJS(`return process`) expect(output).toBe("Error while executing JS") }) - - it("should prevent sandbox escape", () => { - const output = processJS( - `return this.constructor.constructor("return process")()` - ) - expect(output).toBe("Error while executing JS") - }) }) describe("check JS helpers", () => {