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

#3050 XSS in Reports names #3052

Merged
merged 8 commits into from
Nov 25, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
Loading