test(bundler): tolerate whitespace in closing script tag

CodeQL's `js/bad-tag-filter` rule flagged `</script>` as too strict —
`</script >` (with whitespace before `>`) is valid HTML and would slip
past the matcher. Changed to `</script\s*>` for full defense-in-depth.

The bundler always emits the canonical form, so no real-traffic miss —
this is hardening the test's parse-loop, not fixing a downstream bug.

Addresses CodeQL alert on #641.
This commit is contained in:
James
2026-05-06 04:59:41 +00:00
parent 93ab216f2b
commit b075f90b78
@@ -107,7 +107,7 @@ describe("bundleToSingleHtml", () => {
// the separator, parse would fail with an unexpected-token error somewhere
// around the chunk boundary.
const { transformSync } = await import("esbuild");
const re = /<script\b[^>]*>([\s\S]*?)<\/script>/gi;
const re = /<script\b[^>]*>([\s\S]*?)<\/script\s*>/gi;
let m: RegExpExecArray | null;
while ((m = re.exec(bundled)) !== null) {
const body = m[1];