test: tighten external content marker assertion · openclaw/openclaw@686f595
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -496,8 +496,10 @@ describe("external-content security", () => {
|
496 | 496 | |
497 | 497 | // The malicious tags are contained within the safe boundaries |
498 | 498 | const startMatch = result.match(/<<<EXTERNAL_UNTRUSTED_CONTENT id="[a-f0-9]{16}">>>/); |
499 | | -expect(startMatch).not.toBeNull(); |
500 | | -expect(result.indexOf(startMatch![0])).toBeLessThan(result.indexOf("</user>")); |
| 499 | +if (startMatch === null) { |
| 500 | +throw new Error("Expected external content start marker"); |
| 501 | +} |
| 502 | +expect(result.indexOf(startMatch[0])).toBeLessThan(result.indexOf("</user>")); |
501 | 503 | }); |
502 | 504 | }); |
503 | 505 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。