The vulnerability is a classic stored Cross-Site Scripting (XSS) issue within the Flowise admin panel. The root cause is the use of React's dangerouslySetInnerHTML property to render HTML content from user-provided data without proper sanitization. This was identified in multiple UI components:
ViewMessagesDialog: This is the primary component mentioned in the advisory's title ("View Messages"). It rendered chat messages of type 'html' directly into the DOM.
ChatMessage: A similar component for displaying individual chat messages, also using dangerouslySetInnerHTML.
NodeExecutionDetails: This component, used for displaying details of an agent's execution, also rendered artifact data directly as HTML.
JSONViewer: This component used dangerouslySetInnerHTML to render syntax-highlighted JSON, which could be manipulated to include malicious HTML.
The patch addresses this by introducing a new SafeHTML component. This component uses the DOMPurify library to sanitize the HTML content, removing any potentially malicious elements like <script> tags and on* event handlers, before rendering it. By replacing all instances of dangerouslySetInnerHTML with this new safe component, the XSS vulnerability is mitigated across the application.