Fix test
This commit is contained in:
parent
ae7a978998
commit
804f061a70
|
@ -1,3 +1,5 @@
|
||||||
|
import vm from "vm"
|
||||||
|
|
||||||
import { validate as isValidUUID } from "uuid"
|
import { validate as isValidUUID } from "uuid"
|
||||||
|
|
||||||
import { processStringSync, encodeJSBinding } from "@budibase/string-templates"
|
import { processStringSync, encodeJSBinding } from "@budibase/string-templates"
|
||||||
|
@ -40,11 +42,16 @@ describe.each([
|
||||||
expect(output).toBe(3)
|
expect(output).toBe(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
it.only("should prevent sandbox escape", async () => {
|
it("should prevent sandbox escape", async () => {
|
||||||
const output = await processJS(
|
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", () => {
|
describe("helpers", () => {
|
||||||
|
|
Loading…
Reference in New Issue