The vulnerability is a Cross-site Scripting (XSS) issue in n8n caused by improper enforcement of the Content Security Policy (CSP) in webhook responses. The root cause of the vulnerability lies in the isHtmlRenderedContentType function, which is responsible for determining if a given Content-Type should be rendered as HTML. Before the patch, this function did not trim whitespace from the input contentType string. This flaw allowed an attacker to bypass the security check by crafting a Content-Type header with leading or trailing spaces, such as " text/html ". When the application failed to correctly identify this as an HTML content type, it would not apply the necessary CSP sandbox protection, allowing arbitrary JavaScript to be executed in the context of the user's session. The patch addresses this by adding .trim() to the contentType string, ensuring that any whitespace is removed before the comparison is made, thus correctly identifying the content type and applying the appropriate security measures.