From: Frédéric Buclin Date: Mon, 24 Jan 2011 18:40:23 +0000 (+0100) Subject: Bug 619588: (CVE-2010-4567) [SECURITY] Safety checks that disallow clicking for javas... X-Git-Tag: bugzilla-3.2.10~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04b25667d8c195c74f13cbb84ba0c1b52d1fc551;p=thirdparty%2Fbugzilla.git Bug 619588: (CVE-2010-4567) [SECURITY] Safety checks that disallow clicking for javascript: or data: URLs in the URL field can be evaded with prefixed whitespace and Bug 628034: (CVE-2011-0048) [SECURITY] For not-logged-in users, the URL field doesn't safeguard against javascript: or data: URLs r=dkl a=LpSolit --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index c61b88cb69..ec98f3f95d 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -746,6 +746,19 @@ sub create { return $docs_urlbase; }, + # Check whether the URL is safe. + 'is_safe_url' => sub { + my $url = shift; + return 0 unless $url; + + my $safe_protocols = join('|', SAFE_PROTOCOLS); + return 1 if $url =~ /^($safe_protocols):[^\s<>\"]+[\w\/]$/i; + # Pointing to a local file with no colon in its name is fine. + return 1 if $url =~ /^[^\s<>\":]+[\w\/]$/i; + # If we come here, then we cannot guarantee it's safe. + return 0; + }, + # Allow templates to generate a token themselves. 'issue_hash_token' => \&Bugzilla::Token::issue_hash_token, diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index baf5833e08..9f9c4c779f 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -595,8 +595,7 @@