The analysis of the provided patches indicates a stored Cross-Site Scripting (XSS) vulnerability within the Statamic CMS html fieldtype. The root cause is the unsafe rendering of user-provided HTML in a Vue component.
The primary vulnerable function is the rendering logic within resources/js/components/fieldtypes/HtmlFieldtype.vue. Before the patch, this component used v-html="config.html" to display content. The v-html directive in Vue renders raw HTML, and since the config.html value was not sanitized, it was possible for a user with permissions to manage field types to save malicious JavaScript code. This code would then execute in the browser of any user, including high-privileged administrators, who viewed the component in the control panel.
The patch addresses this by introducing the DOMPurify library to sanitize the HTML. A computed property html is added, which cleans the this.config.html value before it is passed to v-html. This ensures that any potentially malicious code is removed before rendering.
Additionally, the Statamic\Fieldtypes\Html::configFieldItems function in src/Fieldtypes/Html.php was modified. This backend function defines the configuration options for the fieldtype. The patch adds a 'sanitize' toggle. While this function doesn't render the HTML, it's the gateway for injecting the payload, making it a relevant function in the context of the vulnerability.