Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Enhance security in debugger by implementing HTML escaping for conten… (#125)

Salman Ahamed43f50725894f
diff --git a/packages/app/src/builder-ui/debugger.ts b/packages/app/src/builder-ui/debugger.ts
index 03815c06..2bd25e95 100644
--- a/packages/app/src/builder-ui/debugger.ts
+++ b/packages/app/src/builder-ui/debugger.ts
@@ -931,9 +931,10 @@ function getFormattedContent(content, compName?) {
let rawContent = typeof content != 'string' ? JSON.stringify(content, null, 2) : content;
rawContent = rawContent.replace(/\\n/g, '\n');
- content = `<textarea readonly class="dbg dbg-textarea text-gray-800">${
- rawContent === '' ? '[empty string]' : rawContent
- }</textarea>${previewBtn}`;
+ // Escape HTML content to prevent XSS attacks when displaying Web Scrape output
+ const escapedContent = rawContent === '' ? '[empty string]' : escapeHTML(rawContent);
+
+ content = `<textarea readonly class="dbg dbg-textarea text-gray-800">${escapedContent}</textarea>${previewBtn}`;
return content;
}