From: Frédéric Buclin Date: Mon, 24 Jan 2011 18:38:50 +0000 (+0100) Subject: Bug 619588: (CVE-2010-4567) [SECURITY] Safety checks that disallow clicking for javas... X-Git-Tag: bugzilla-3.4.10~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae718be5e742aa62a03ecbd77917547d0043b19d;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 bafdf806f5..529a264328 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -764,6 +764,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 f7378c6cf0..0e1c4da687 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -613,8 +613,7 @@