From 4d01839bd3850988b8ecfaad13b198e5b665b8de Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 14 Jul 2026 08:39:13 +0000 Subject: [PATCH 1/3] Initial commit with task details Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: https://github.com/xlabtg/teleton-agent/issues/711 --- .gitkeep | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitkeep diff --git a/.gitkeep b/.gitkeep new file mode 100644 index 00000000..793e1c4c --- /dev/null +++ b/.gitkeep @@ -0,0 +1 @@ +# .gitkeep file auto-generated at 2026-07-14T08:39:13.382Z for PR creation at branch issue-711-fb6ee98f2eb1 for issue https://github.com/xlabtg/teleton-agent/issues/711 \ No newline at end of file From baeb4e4742bb94e9b5111fb7a836e74236b9c5ce Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 14 Jul 2026 08:56:47 +0000 Subject: [PATCH 2/3] =?UTF-8?q?test(sanitize):=20=D0=B2=D0=BE=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B8=D0=B7=D0=B2=D0=B5=D1=81=D1=82=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=82=D0=B5=D1=80=D1=8E=20=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/__tests__/sanitize.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/__tests__/sanitize.test.ts b/src/utils/__tests__/sanitize.test.ts index 1936d928..8822b1fa 100644 --- a/src/utils/__tests__/sanitize.test.ts +++ b/src/utils/__tests__/sanitize.test.ts @@ -265,6 +265,11 @@ describe("sanitizeForPrompt", () => { expect(sanitizeForPrompt(input)).toBe("3 < 5 and 7 > 2"); }); + it("should preserve plain text after a tag when it is followed by >", () => { + expect(sanitizeForPrompt("foo>bar")).toBe("foo>bar"); + expect(sanitizeForPrompt("hello world")).toBe("hello world"); + }); + it("should handle malformed tags", () => { const input = "Text { }); describe("sanitizeTaskDescription", () => { + it("should preserve plain text after a tag when it is followed by >", () => { + expect(sanitizeTaskDescription("foo>bar")).toBe("foo>bar"); + }); + it("should remove fragmented nested script tags", () => { const input = "t>alert(1)t>"; const result = sanitizeTaskDescription(input); From d79bedc0ee5e29c997154558ef2e35f5ad034d26 Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 14 Jul 2026 08:59:48 +0000 Subject: [PATCH 3/3] =?UTF-8?q?fix(sanitize):=20=D1=81=D0=BE=D1=85=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D1=8F=D1=82=D1=8C=20=D1=82=D0=B5=D0=BA=D1=81=D1=82?= =?UTF-8?q?=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=B7=D0=B0=D0=BA=D1=80?= =?UTF-8?q?=D1=8B=D1=82=D0=B8=D1=8F=20=D1=82=D0=B5=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitkeep | 1 - src/utils/sanitize.ts | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 .gitkeep diff --git a/.gitkeep b/.gitkeep deleted file mode 100644 index 793e1c4c..00000000 --- a/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -# .gitkeep file auto-generated at 2026-07-14T08:39:13.382Z for PR creation at branch issue-711-fb6ee98f2eb1 for issue https://github.com/xlabtg/teleton-agent/issues/711 \ No newline at end of file diff --git a/src/utils/sanitize.ts b/src/utils/sanitize.ts index 100e8645..5b7d8931 100644 --- a/src/utils/sanitize.ts +++ b/src/utils/sanitize.ts @@ -13,13 +13,15 @@ function stripMarkupTags(text: string): string { if (text[i] === "<" && isTagStart(text, i)) { let end = text.indexOf(">", i + 1); if (end !== -1) { - let next = end + 1; - while (next < text.length) { - const fragmentEnd = text.indexOf(">", next); - if (fragmentEnd === -1) break; - if (!isTagNameFragment(text.slice(next, fragmentEnd))) break; - end = fragmentEnd; - next = end + 1; + if (text.slice(i + 1, end).includes("<")) { + let next = end + 1; + while (next < text.length) { + const fragmentEnd = text.indexOf(">", next); + if (fragmentEnd === -1) break; + if (!isTagNameFragment(text.slice(next, fragmentEnd))) break; + end = fragmentEnd; + next = end + 1; + } } i = end; continue;