Skip to content

Commit 753e1f8

Browse files
authored
Fixing unsafe HTML constructed from library input (#3316)
1 parent 775d2ab commit 753e1f8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/playground/src/ds/createDesignSystem.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,12 @@ export const createDesignSystem = (sandbox: Sandbox) => {
328328
if (key === "kind") {
329329
suffix = ` (SyntaxKind.${info.name})`
330330
}
331-
li.innerHTML = `${key}: <span class='${typeofSpan}'>${value}</span>${suffix}`
331+
li.textContent = `${key}: `;
332+
const span = document.createElement('span');
333+
span.className = typeofSpan;
334+
span.textContent = value;
335+
li.appendChild(span);
336+
li.appendChild(document.createTextNode(suffix));
332337
return li
333338
}
334339

0 commit comments

Comments
 (0)