The vulnerability lies in the addDefaultPortlet function within the resources/skins.citizen.preferences/addPortlet.polyfill.js file. The description clearly states that innerHTML is used with textContent, leading to an XSS vulnerability.
Commit a741639085d70c22a9f49890542a142a223bf981 introduced the vulnerable file addPortlet.polyfill.js and the addDefaultPortlet function containing the line labelDiv.innerHTML = label.textContent || '';. This line is problematic because label.textContent can originate from system messages (like citizen-feature-custom-font-size-name mentioned in the PoC) which, if editable by an attacker, can contain malicious HTML. Assigning this directly to innerHTML causes the browser to parse and render this HTML, leading to XSS.
Commit 93c36ac778397e0e7c46cf7adb1e5d848265f1bd fixes this vulnerability by changing the problematic line to labelDiv.textContent = label.textContent || '';. Using textContent for assignment ensures that the string is treated as plain text and not parsed as HTML, thus mitigating the XSS risk.
The function addDefaultPortlet is directly responsible for creating and inserting the DOM element (labelDiv) where the malicious HTML can be injected. Therefore, it is the vulnerable function that would appear in a runtime profile during the exploitation of this XSS vulnerability.