1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00
This commit is contained in:
Adria Navarro 2024-02-19 17:32:33 +01:00
parent ae7a978998
commit 804f061a70

View file

@ -1,3 +1,5 @@
import vm from "vm"
import { validate as isValidUUID } from "uuid"
import { processStringSync, encodeJSBinding } from "@budibase/string-templates"
@ -40,11 +42,16 @@ describe.each([
expect(output).toBe(3)
})
it.only("should prevent sandbox escape", async () => {
it("should prevent sandbox escape", async () => {
const output = await processJS(
`return this.constructor.constructor("return process")()`
`return this.constructor.constructor("return process.env")()`
)
expect(output).toBe("Error while executing JS")
if (useIsolatedVM) {
expect(output).toBe("Error while executing JS")
} else {
expect(output).not.toBe("Error while executing JS")
expect(output).toEqual(process.env)
}
})
describe("helpers", () => {