CVE-2021-4284 (Other, published 2022-12-27T10:15Z)
Description: value: A vulnerability classified as problematic has been found in OpenMRS HTML Form Entry UI Framework Integration Module up to 1.x. This affects an unknown part. The manipulation leads to cross site scripting. It is possible to initiate the attack remotely. Upgrading to version 2.0.0 is able to address this issue. The name of the patch is 811990972ea07649ae33c4b56c61c3b520895f07. It is recommended to upgrade the affected component. The identifier VDB-216873 was assigned to this vulnerability.
Severity: nan (CVSS v3 base score: 6.1)
Weakness: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
Repository: https://github.com/openmrs/openmrs-module-htmlformentryui
Files changed:
api/src/main/java/org/openmrs/module/htmlformentryui/HtmlFormUtil.java
omod/src/main/java/org/openmrs/module/htmlformentryui/fragment/controller/htmlform/EnterHtmlFormFragmentController.java
omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java
omod/src/main/webapp/pages/htmlform/editHtmlFormWithSimpleUi.gsp
omod/src/main/webapp/pages/htmlform/editHtmlFormWithStandardUi.gsp
omod/src/main/webapp/pages/htmlform/enterHtmlFormWithSimpleUi.gsp
omod/src/main/webapp/pages/htmlform/enterHtmlFormWithStandardUi.gsp
omod/src/main/webapp/pages/htmlform/viewEncounterWithHtmlForm.gsp
Commit message: Ra 1424:  escapeJs is vulnerable to XSS attacks  (#51)

* RA-1424: escapeJs vulnerable to XSS

* RA-1424: escapeJs vulnerable to XSS

Vulnerable code:
			return ui.escapeJs(ui.format(patient));
		        ui.format(hf.getForm()), ui.escapeJs(ui.format(patient))));
			returnLabel = ui.escapeJs(ui.format(patient.getPatient()));
        { label: "${ ui.escapeJs(ui.message("coreapps.editHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }
        { label: "${ ui.escapeJs(ui.message("coreapps.editHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }
        { label: "${ ui.escapeJs(ui.format(htmlForm.form)) }" }
        { label: "${ ui.message(ui.escapeJs(ui.format(htmlForm.form)) )}" }
        returnUrl: "${ ui.escapeJs(returnUrl) }",
        { label: "${ ui.escapeJs(returnLabel) }", link: "${ ui.escapeJs(returnUrl) }" },
        { label: "${ ui.escapeJs(ui.message("htmlformentryui.viewHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }

Fixed code:
			return ui.encodeJavaScript(ui.format(patient));
		        ui.format(hf.getForm()), ui.encodeJavaScript(ui.format(patient))));
			returnLabel = ui.encodeJavaScript(ui.format(patient.getPatient()));
        { label: "${ ui.encodeJavaScript(ui.message("coreapps.editHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }
        { label: "${ ui.encodeJavaScript(ui.message("coreapps.editHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }
        { label: "${ ui.encodeJavaScript(ui.format(htmlForm.form)) }" }
        { label: "${ ui.message(ui.encodeJavaScript(ui.format(htmlForm.form)) )}" }
        returnUrl: "${ ui.encodeJavaScript(returnUrl) }",
        { label: "${ ui.encodeJavaScript(returnLabel) }", link: "${ ui.encodeJavaScript(returnUrl) }" },
        { label: "${ ui.encodeJavaScript(ui.message("htmlformentryui.viewHtmlForm.breadcrumb", ui.message(ui.format(htmlForm.form)))) }" }