The vulnerability is a stored Cross-Site Scripting (XSS) weakness in the Trix editor, identified as GHSA-qmpg-8xg6-ph5q. The root cause is the improper sanitization of HTML content, specifically the failure to remove the data-trix-serialized-attributes attribute. An attacker could embed a malicious payload within this attribute.
The analysis of the patch commit 53197ab5a142e6b0b76127cb790726b274eaf1bc reveals that the fix involves adding a hook to the DOMPurify library. This hook, uponSanitizeAttribute, now explicitly checks for and removes the data-trix-serialized-attributes attribute during the sanitization process.
The primary function that orchestrates this sanitization is HTMLSanitizer.sanitize. Before the patch, a call to this function with malicious HTML would result in an output that is not properly sanitized, as it would still contain the dangerous attribute. Subsequent processing of this content by the Trix editor would deserialize the attribute's value and apply it to DOM elements, triggering the XSS payload.
Therefore, HTMLSanitizer.sanitize is the key vulnerable function. It would appear in a runtime profile or stack trace during the initial processing of the malicious content. The fix was applied to the source file src/trix/models/html_sanitizer.js for the trix npm package and the corresponding bundled file action_text-trix/app/assets/javascripts/trix.js for the action_text-trix RubyGem.