From 1e6a7b66e8d5b528039e025f1d92735f741246e1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 7 Oct 2024 17:42:35 +0100 Subject: [PATCH] pr comments --- .../src/sdk/app/rows/tests/utils.spec.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/server/src/sdk/app/rows/tests/utils.spec.ts b/packages/server/src/sdk/app/rows/tests/utils.spec.ts index 9b7711993e..a7bfee3ea9 100644 --- a/packages/server/src/sdk/app/rows/tests/utils.spec.ts +++ b/packages/server/src/sdk/app/rows/tests/utils.spec.ts @@ -8,7 +8,7 @@ import { import { generateTableID } from "../../../../db/utils" import { validate } from "../utils" import { generator } from "@budibase/backend-core/tests" -import environment from "../../../../environment" +import { withEnv } from "../../../../environment" describe("validate", () => { const hour = () => generator.hour().toString().padStart(2, "0") @@ -364,15 +364,15 @@ describe("validate", () => { "/* This is a comment */ SELECT * FROM users", '', ])("test potentially unsafe input: %s", async input => { - environment.XSS_SAFE_MODE = true - const table = getTable() - const row = { text: input } - const output = await validate({ source: table, row }) - expect(output.valid).toBe(false) - expect(output.errors).toBe([ - "Input not sanitised - potentially vulnerable to XSS", - ]) - environment.XSS_SAFE_MODE = false + withEnv({ XSS_SAFE_MODE: "1" }, async () => { + const table = getTable() + const row = { text: input } + const output = await validate({ source: table, row }) + expect(output.valid).toBe(false) + expect(output.errors).toStrictEqual({ + text: ["Input not sanitised - potentially vulnerable to XSS"], + }) + }) }) }) })