Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch XSS in reporting #141

Merged
merged 1 commit into from Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Patch XSS in reporting
  • Loading branch information
isears committed Apr 18, 2017
commit 0023a659288538d2763835847d3414ecb18b931a
4 changes: 2 additions & 2 deletions omod/src/main/webapp/portlets/baseMetadata.jsp
Expand Up @@ -42,7 +42,7 @@
<div style="margin:0; padding:0; width:100%;">
<div class="metadataField">
<label class="desc" for="name"><spring:message code="reporting.name" /></label>
<input type="text" id="name" tabindex="1" name="name" value="${model.obj.name}" size="50"/>
<input type="text" id="name" tabindex="1" name="name" value="<c:out value='${model.obj.name}' />" size="50"/>
</div>
<c:if test="${!empty model.obj && model.showType != 'false'}">
<div class="metadataField">
Expand All @@ -52,7 +52,7 @@
</c:if>
<div class="metadataField">
<label class="desc" for="description"><spring:message code="reporting.description" /></label>
<textarea id="description" cols="80" rows="10" tabindex="2" name="description">${model.obj.description}</textarea>
<textarea id="description" cols="80" rows="10" tabindex="2" name="description"><c:out value='${model.obj.description}' /></textarea>
</div>
</div>
<hr style="color:blue;"/>
Expand Down
4 changes: 2 additions & 2 deletions omod/src/main/webapp/reports/manageReports.jsp
Expand Up @@ -73,7 +73,7 @@
<rpt:displayLabel type="${reportDefinition['class'].name}"/>
</td>
<td width="5%" nowrap>
${reportDefinition.creator}
<c:out value="${reportDefinition.creator}" />
</td>
<td width="5%" nowrap>
<rpt:timespan then="${reportDefinition.dateCreated}"/>
Expand All @@ -82,7 +82,7 @@
&nbsp;
<a href="${editUrl}"><img src="<c:url value='/images/edit.gif'/>" border="0"/></a>
&nbsp;
<a href="javascript:confirmDelete('${reportDefinition.name}','${reportDefinition.uuid}');"><img src="<c:url value='/images/trash.gif'/>" border="0"/></a>
<a href="javascript:confirmDelete('<c:out value="${openmrs:getSafeJsString(reportDefinition.name)}" />','${reportDefinition.uuid}');"><img src="<c:url value='/images/trash.gif'/>" border="0"/></a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are using c:out, do we then need getSafeJsString?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We have inline javascript embedded into html here, so we have to make sure the input is safe for use in both languages. The problem with c:out alone is that it converts all single/double quote characters to html entities, which break the in-line javascript.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh i see! Thanks for the detailed explanation. 😊

&nbsp;
<a href="${pageContext.request.contextPath}/module/reporting/run/runReport.form?reportId=${reportDefinition.uuid}">
<img src='<c:url value="/images/play.gif"/>' align="absmiddle" border="0"/>
Expand Down