Skip to content

Commit

Permalink
Merge pull request #3052 from SCADA-LTS/fix/#3050_XSS_in_Reports_names
Browse files Browse the repository at this point in the history
#3050 XSS in Reports names
  • Loading branch information
Limraj authored Nov 25, 2024
2 parents c95948e + 05c83d2 commit a06a15c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions WebContent/WEB-INF/ftl/report/reportChart.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<td>
<table>
<tr>
<td colspan="2"><h1>${instance.name}</h1></td>
<td colspan="2"><h1>${security.escapeHtml(instance.name)}</h1></td>
</tr>
<tr>
<td class="label"><@fmt key="reports.runTimeStart"/></td>
Expand Down Expand Up @@ -121,7 +121,7 @@

<td class="stats">
<table>
<tr><td colspan="2" class="pointName">${point.name}</td></tr>
<tr><td colspan="2" class="pointName">${security.escapeHtml(point.name)}</td></tr>
<tr>
<td class="label"><@fmt key="reports.dataType"/></td>
<td>${point.dataTypeDescription}</td>
Expand Down
5 changes: 3 additions & 2 deletions WebContent/WEB-INF/jsp/reports.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
hide("noReportInstances");
dwr.util.addRows("reportInstancesList", instanceArray,
[
function(ri) { return "<span>" + ri.name + "</span>"; },
function(ri) { return "<span>" + escapeHtml(ri.name) + "</span>"; },
function(ri) { return ri.prettyRunStartTime; },
function(ri) { return ri.prettyRunDuration; },
function(ri) { return ri.prettyReportStartTime; },
Expand Down Expand Up @@ -336,7 +336,8 @@
}
function updateReport(id, name) {
$("r"+ id +"Name").innerHTML = name;
let escapedName = escapeHtml(name);
$("r"+ id +"Name").innerHTML = escapedName;
}
function clearMessages() {
Expand Down
2 changes: 2 additions & 0 deletions src/com/serotonin/mango/vo/report/ReportChartCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import freemarker.template.Template;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.directwebremoting.Security;
import org.jfree.data.time.TimeSeries;
import org.scada_lts.mango.service.SystemSettingsService;
import org.scada_lts.utils.ColorUtils;
Expand Down Expand Up @@ -123,6 +124,7 @@ public void createContent(ReportInstance reportInstance, ReportDao reportDao, St
model.put("instance", reportInstance);
model.put("points", pointStatistics);
model.put("inline", inlinePrefix == null ? "" : "cid:");
model.put("security", new Security());

model.put("ALPHANUMERIC", DataTypes.ALPHANUMERIC);
model.put("BINARY", DataTypes.BINARY);
Expand Down
2 changes: 1 addition & 1 deletion src/com/serotonin/mango/vo/report/SeriesIdentifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public int hashCode() {

@Override
public String toString() {
return XssProtectHtmlEscapeUtils.escape(name);
return name;
}
}

0 comments on commit a06a15c

Please sign in to comment.