test: tighten external content marker assertion

This commit is contained in:
Shakker
2026-05-08 17:16:29 +01:00
parent c223fa61cd
commit 686f595c47

View File

@@ -496,8 +496,10 @@ describe("external-content security", () => {
// The malicious tags are contained within the safe boundaries
const startMatch = result.match(/<<<EXTERNAL_UNTRUSTED_CONTENT id="[a-f0-9]{16}">>>/);
expect(startMatch).not.toBeNull();
expect(result.indexOf(startMatch![0])).toBeLessThan(result.indexOf("</user>"));
if (startMatch === null) {
throw new Error("Expected external content start marker");
}
expect(result.indexOf(startMatch[0])).toBeLessThan(result.indexOf("</user>"));
});
});
});