Skip to content

Commit

Permalink
escape HTML unsafe characters properly
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Sep 8, 2012
1 parent 4c405be commit 6dcbef2
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Map;
import java.util.Set;

import hudson.Functions;
import hudson.model.AbstractBuild;

import java.util.logging.Level;
Expand Down Expand Up @@ -249,14 +251,14 @@ public String severityColumn(Violation v) {
b.append("<tr>\n");
b.append("<th>Class</th>\n");
b.append("<td>");
b.append(v.getSource());
b.append(Functions.escape(v.getSource()));
b.append("</td>\n");
b.append("</tr>\n");

b.append("<tr>\n");
b.append("<th>Detail</th>\n");
b.append("<td class='message'>");
b.append(v.getSourceDetail());
b.append(Functions.escape(v.getSourceDetail()));
b.append("</td>\n");
b.append("</tr>\n");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:st="jelly:stapler"
xmlns:d="jelly:define"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form"
xmlns:v="/hudson/plugins/violations/tags"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:st="jelly:stapler"
xmlns:d="jelly:define"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form">
Expand Down Expand Up @@ -27,7 +28,7 @@
<j:forEach var="t" items="${model.typeMap.entrySet()}">
<table class="pane">
<tbody>
<tr><td class="pane-header" colspan="5">${it.typeLine(t.key)}</td></tr>
<tr><td class="pane-header" colspan="5"><j:out value="${it.typeLine(t.key)}"/></td></tr>
<j:forEach var="v" items="${t.value}">
<tr>
<td class="pane">
Expand All @@ -39,7 +40,7 @@
</j:if>
</td>
<!--<td class="pane">${v.source}</td> -->
<td class="pane">${it.severityColumn(v)}</td>
<td class="pane"><j:out value="${it.severityColumn(v)}"/></td>
<td class="pane" width="99%">${v.message}</td>
</tr>
</j:forEach>
Expand All @@ -48,7 +49,7 @@
<p></p>
</j:forEach>

${it.fileContent}
<j:out value="${it.fileContent}"/>

<!--
<j:set var="line" value="${model.nextLine}"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:d="jelly:define" xmlns:l="/lib/layout"
xmlns:t="/lib/hudson" xmlns:f="/lib/form">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j="jelly:core"
xmlns:st="jelly:stapler"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<!--
Attributes:
report: the violationsReport (may be null)
Expand Down

0 comments on commit 6dcbef2

Please sign in to comment.