summaryrefslogtreecommitdiffstats
path: root/showdependencygraph.cgi
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-05-16 23:17:24 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-05-16 23:17:31 +0200
commit38087366e2ff317275c4e408be9e304b9c8b4f97 (patch)
tree5923509a1630a5b75adf1989039cd767d89189d2 /showdependencygraph.cgi
parentd63cbb53cdc3608789db5c6041dd544d4697765a (diff)
downloadbugzilla-38087366e2ff317275c4e408be9e304b9c8b4f97.tar.gz
bugzilla-38087366e2ff317275c4e408be9e304b9c8b4f97.tar.xz
Bug 1273245 - [SECURITY] Backport upstream bug 1253263 to bmo/4.2 to fix XSS vulnerability in dependency graphs via bug summary
Diffstat (limited to 'showdependencygraph.cgi')
-rwxr-xr-xshowdependencygraph.cgi8
1 files changed, 7 insertions, 1 deletions
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index 24f3b8469..5dc3928ed 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -68,13 +68,19 @@ sub CreateImagemap {
$default = qq{<area alt="" shape="default" href="$1">\n};
}
- if ($line =~ /^rectangle \((.*),(.*)\) \((.*),(.*)\) (http[^ ]*) (\d+)(\\n.*)?$/) {
+ if ($line =~ /^rectangle \((\d+),(\d+)\) \((\d+),(\d+)\) (http[^ ]*) (\d+)(?:\\n.*)?$/) {
my ($leftx, $rightx, $topy, $bottomy, $url, $bugid) = ($1, $3, $2, $4, $5, $6);
# Pick up bugid from the mapdata label field. Getting the title from
# bugtitle hash instead of mapdata allows us to get the summary even
# when showsummary is off, and also gives us status and resolution.
+ # This text is safe; it has already been escaped.
my $bugtitle = $bugtitles{$bugid};
+
+ # The URL is supposed to be safe, because it's built manually.
+ # But in case someone manages to inject code, it's safer to escape it.
+ $url = html_quote($url);
+
$map .= qq{<area alt="bug $bugid" name="bug$bugid" shape="rect" } .
qq{title="$bugtitle" href="$url" } .
qq{coords="$leftx,$topy,$rightx,$bottomy">\n};