Skip to content

Commit a20400f

Browse files
committed
fix: replace real domain URLs with example.test in tests
Address CodeQL "Incomplete URL substring sanitization" finding by using reserved example.test domains instead of fonts.googleapis.com in test fixtures. Change-Id: I38596faa833c770757bcf91131d99a72e8868d21 Co-developed-by: Qoder CLI <noreply@qoder.com>
1 parent fca19d7 commit a20400f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

apps/webui/src/lib/view/artifact.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ describe("extractArtifacts", () => {
233233
"",
234234
"```html",
235235
"<!DOCTYPE html>",
236-
'<link rel="preconnect" href="https://fonts.googleapis.com">',
237-
'<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',
238-
'<link href="https://fonts.googleapis.com/css2?family=Inter" rel="stylesheet">',
236+
'<link rel="preconnect" href="https://cdn.example.test">',
237+
'<link rel="preconnect" href="https://assets.example.test" crossorigin>',
238+
'<link href="https://cdn.example.test/styles.css" rel="stylesheet">',
239239
"```",
240240
"",
241241
"预览:https://preview.example.com/page",
@@ -357,7 +357,7 @@ describe("document extraction", () => {
357357
test("URLs inside an extracted HTML document are NOT extracted as artifacts", () => {
358358
const html = makeHtmlDocument().replace(
359359
"</head>",
360-
'<link href="https://fonts.googleapis.com/css2?family=Inter" rel="stylesheet"></head>',
360+
'<link href="https://cdn.example.test/styles.css" rel="stylesheet"></head>',
361361
);
362362
const { segments } = extractArtifacts(html);
363363
const artifacts = segments.filter((s) => s.type === "artifact" || s.type === "images");
@@ -370,16 +370,16 @@ describe("document extraction", () => {
370370
"",
371371
"```html",
372372
"<!DOCTYPE html>",
373-
'<link rel="preconnect" href="https://fonts.googleapis.com">',
374-
'<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',
375-
'<link href="https://fonts.googleapis.com/css2?family=Inter" rel="stylesheet">',
373+
'<link rel="preconnect" href="https://cdn.example.test">',
374+
'<link rel="preconnect" href="https://assets.example.test" crossorigin>',
375+
'<link href="https://cdn.example.test/styles.css" rel="stylesheet">',
376376
"```",
377377
"",
378378
"预览:https://preview.example.com/page",
379379
].join("\n");
380380
const { segments } = extractArtifacts(input);
381381
// The fenced block is too short to be a document — stays as text.
382-
expect(segments.some((s) => s.type === "text" && s.content.includes("fonts.googleapis.com"))).toBe(true);
382+
expect(segments.some((s) => s.type === "text" && s.content.includes("cdn.example.test"))).toBe(true);
383383
expect(segments.every((s) => s.type !== "document")).toBe(true);
384384
});
385385

0 commit comments

Comments
 (0)