The vulnerability is a classic stored Cross-Site Scripting (XSS) issue within the Liferay Portal's workflow task management. The root cause is the failure to properly sanitize user-provided data, specifically the user name associated with a workflow task, before it is rendered on the 'My Workflow Tasks' page.
The provided patch, commit 5f1a7c347c81f05848f032a9e25cbc9abaab05ff, clearly shows that the getUserName() method's return value was being directly embedded into the HTML of view.jsp. An attacker could create a user with a name containing a malicious script (e.g., <script>alert(1)</script>). When this user is involved in a workflow, their name is displayed on the 'My Workflow Tasks' page, and the script would execute in the browser of any user viewing that page.
The fix involves wrapping the output of workflowTask.getUserName() with HtmlUtil.escape(). This function neutralizes any embedded HTML or script tags by converting them into their corresponding HTML entities (e.g., < becomes <), thus preventing the browser from executing them.
The vulnerable function is identified as com.liferay.portal.workflow.task.web.internal.display.context.WorkflowTaskDisplayContext.getUserName because it is the source of the untrusted data that is rendered in the JSP. While the vulnerability manifests in the JSP file, the data originates from this method. A runtime profiler would show this method being called as part of the rendering process for the 'My Workflow Tasks' page.