From: Dylan William Hardison
Date: Wed, 21 Feb 2018 18:59:53 +0000 (-0500)
Subject: Bug 1439797 - Enable reporting-only CSP by default
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d435e0a5b0e07c145f929457313d8d7738f42b14;p=thirdparty%2Fbugzilla.git
Bug 1439797 - Enable reporting-only CSP by default
---
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 35d6dd687..513d8c302 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -34,8 +34,9 @@ BEGIN {
sub DEFAULT_CSP {
my %policy = (
default_src => [ 'self' ],
- script_src => [ 'self', 'unsafe-inline', 'unsafe-eval', 'https://www.google-analytics.com' ],
- child_src => [ 'self', ],
+ script_src => [ 'self', 'nonce', 'unsafe-inline', 'https://www.google-analytics.com' ],
+ frame_src => [ 'none', ],
+ worker_src => [ 'none', ],
img_src => [ 'self', 'https://secure.gravatar.com', 'https://www.google-analytics.com' ],
style_src => [ 'self', 'unsafe-inline' ],
object_src => [ 'none' ],
@@ -45,7 +46,7 @@ sub DEFAULT_CSP {
'https://www.google.com/search'
],
frame_ancestors => [ 'none' ],
- disable => 1,
+ report_only => 1,
);
if (Bugzilla->params->{github_client_id} && !Bugzilla->user->id) {
push @{$policy{form_action}}, 'https://github.com/login/oauth/authorize', 'https://github.com/login';
@@ -68,11 +69,8 @@ sub SHOW_BUG_MODAL_CSP {
# This is from extensions/OrangeFactor/web/js/orange_factor.js
'https://brasstacks.mozilla.com/orangefactor/api/count',
],
- child_src => [
- 'self',
- # This is for the socorro lens addon and is to be removed by Bug 1332016
- 'https://ashughes1.github.io/bugzilla-socorro-lens/chart.htm'
- ],
+ frame_src => [ 'none', ],
+ worker_src => [ 'none', ],
);
if (use_attachbase() && $bug_id) {
my $attach_base = Bugzilla->localconfig->{'attachment_base'};
@@ -194,7 +192,7 @@ sub content_security_policy {
require Bugzilla::CGI::ContentSecurityPolicy;
if (%add_params || !$self->{Bugzilla_csp}) {
my %params = DEFAULT_CSP;
- delete $params{disable} if %add_params && !$add_params{disable};
+ delete $params{report_only} if %add_params && !$add_params{report_only};
foreach my $key (keys %add_params) {
if (defined $add_params{$key}) {
$params{$key} = $add_params{$key};
diff --git a/Bugzilla/CGI/ContentSecurityPolicy.pm b/Bugzilla/CGI/ContentSecurityPolicy.pm
index 88f2732bc..50a399cdc 100644
--- a/Bugzilla/CGI/ContentSecurityPolicy.pm
+++ b/Bugzilla/CGI/ContentSecurityPolicy.pm
@@ -34,10 +34,10 @@ my $REFERRER_KEYWORD = enum [qw(
my @ALL_BOOL = qw( sandbox upgrade_insecure_requests );
my @ALL_SRC = qw(
- default_src child_src connect_src
+ default_src worker_src connect_src
font_src img_src media_src
object_src script_src style_src
- frame_ancestors form_action
+ frame_src frame_ancestors form_action
);
has \@ALL_SRC => ( is => 'ro', isa => $SOURCE_LIST, predicate => 1 );
diff --git a/chart.cgi b/chart.cgi
index 26f21c389..36357cb3c 100755
--- a/chart.cgi
+++ b/chart.cgi
@@ -51,6 +51,7 @@ local our $cgi = Bugzilla->cgi;
local our $template = Bugzilla->template;
local our $vars = {};
my $dbh = Bugzilla->dbh;
+$cgi->content_security_policy(report_only => 0);
my $user = Bugzilla->login(LOGIN_REQUIRED);
diff --git a/extensions/BMO/template/en/default/account/create.html.tmpl b/extensions/BMO/template/en/default/account/create.html.tmpl
index d29303104..10d5fb5c1 100644
--- a/extensions/BMO/template/en/default/account/create.html.tmpl
+++ b/extensions/BMO/template/en/default/account/create.html.tmpl
@@ -38,7 +38,7 @@
style_urls = [ 'extensions/BMO/web/styles/create_account.css' ]
%]
-
@@ -200,7 +200,7 @@ function validateAndSubmit() {
Calendar
-
diff --git a/extensions/BMO/template/en/default/bug/create/create-creative.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-creative.html.tmpl
index 13620d1c4..eac24e53e 100644
--- a/extensions/BMO/template/en/default/bug/create/create-creative.html.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/create-creative.html.tmpl
@@ -209,7 +209,7 @@ function toggleTypeOther(element) {
Calendar
-
diff --git a/extensions/BMO/template/en/default/bug/create/create-fsa-budget.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-fsa-budget.html.tmpl
index 942b37afa..d97d95b2a 100644
--- a/extensions/BMO/template/en/default/bug/create/create-fsa-budget.html.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/create-fsa-budget.html.tmpl
@@ -139,7 +139,7 @@ function validateAndSubmit() {
Calendar
-
diff --git a/extensions/BMO/template/en/default/bug/create/create-mozlist.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-mozlist.html.tmpl
index ab03523ae..841477099 100644
--- a/extensions/BMO/template/en/default/bug/create/create-mozlist.html.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/create-mozlist.html.tmpl
@@ -16,7 +16,7 @@
style = ".mandatory{color:red;font-size:80%;}"
%]
-
@@ -341,7 +341,7 @@ function validate_form() {
Calendar
-
@@ -355,7 +355,7 @@ function validate_form() {
Calendar
-
diff --git a/extensions/BMO/template/en/default/bug/create/create-swag.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-swag.html.tmpl
index 859d77194..28b8045f6 100644
--- a/extensions/BMO/template/en/default/bug/create/create-swag.html.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/create-swag.html.tmpl
@@ -810,7 +810,7 @@ function showGear() {
We do this to help protect the personal identifying information in this [% terms.bugs %].
-
diff --git a/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl b/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
index 5486684f1..632ccb1e6 100644
--- a/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
@@ -30,7 +30,7 @@
This security group needs to be set to SHOWN/SHOWN
-
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
index 6e15e50d3..1dec71b8d 100644
--- a/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/edit-after_importance.html.tmpl
@@ -7,7 +7,7 @@
#%]
[%# Display product and component descriptions after their respective fields %]
-
@@ -177,7 +177,7 @@ function validateAndSubmit() {
Calendar
-
@@ -192,7 +192,7 @@ function validateAndSubmit() {
Calendar
-
diff --git a/extensions/BMO/template/en/default/pages/release_tracking_report.html.tmpl b/extensions/BMO/template/en/default/pages/release_tracking_report.html.tmpl
index 79587205c..8ee3d0d59 100644
--- a/extensions/BMO/template/en/default/pages/release_tracking_report.html.tmpl
+++ b/extensions/BMO/template/en/default/pages/release_tracking_report.html.tmpl
@@ -18,7 +18,7 @@
JavaScript is required to use this report.
-
diff --git a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl
index 33aa27e3d..075c8edf9 100644
--- a/extensions/BMO/template/en/default/pages/user_activity.html.tmpl
+++ b/extensions/BMO/template/en/default/pages/user_activity.html.tmpl
@@ -83,7 +83,7 @@
[% END %]
-
diff --git a/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl b/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
index 32cb55ea1..bb1381c46 100644
--- a/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
+++ b/extensions/BugmailFilter/template/en/default/account/prefs/bugmail_filter.html.tmpl
@@ -14,7 +14,7 @@
[% SET selectable_products = user.get_selectable_products %]
[% SET dont_show_button = 1 %]
-
-
@@ -50,7 +50,7 @@ YAHOO.util.Dom.removeClass('loading', 'hidden');
Switch to the advanced [% terms.bug %] entry form
-
-
diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl
index 62f45d568..5c19ac758 100644
--- a/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl
+++ b/extensions/REMO/template/en/default/bug/create/create-remo-budget.html.tmpl
@@ -23,7 +23,7 @@
any persons designated in the CC line, and authorized members of the Mozilla
Rep team.
-
diff --git a/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl b/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl
index 10f65de39..af3db60bc 100644
--- a/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl
+++ b/extensions/REMO/template/en/default/bug/create/create-remo-it.html.tmpl
@@ -17,7 +17,7 @@
[% USE Bugzilla %]
[% mandatory = '* ' %]
-
+
Mozilla Reps - Payment Form
diff --git a/extensions/Review/template/en/default/hook/attachment/create-end.html.tmpl b/extensions/Review/template/en/default/hook/attachment/create-end.html.tmpl
index 22d95d694..ed5ae7b36 100644
--- a/extensions/Review/template/en/default/hook/attachment/create-end.html.tmpl
+++ b/extensions/Review/template/en/default/hook/attachment/create-end.html.tmpl
@@ -10,7 +10,7 @@
[% bug = attachment.bug %]
[% END %]
-
diff --git a/extensions/Review/template/en/default/pages/review_history.html.tmpl b/extensions/Review/template/en/default/pages/review_history.html.tmpl
index d80ed5e0a..c8263bc52 100644
--- a/extensions/Review/template/en/default/pages/review_history.html.tmpl
+++ b/extensions/Review/template/en/default/pages/review_history.html.tmpl
@@ -19,7 +19,7 @@
'js/field.js' ]
%]
-
[% IF !new_bug && user.id %]
@@ -47,7 +47,7 @@
[% END %]
-
diff --git a/extensions/TrackingFlags/template/en/default/hook/bug/create/create-form.html.tmpl b/extensions/TrackingFlags/template/en/default/hook/bug/create/create-form.html.tmpl
index 4bb9e1eab..005cc8062 100644
--- a/extensions/TrackingFlags/template/en/default/hook/bug/create/create-form.html.tmpl
+++ b/extensions/TrackingFlags/template/en/default/hook/bug/create/create-form.html.tmpl
@@ -28,7 +28,7 @@
END;
%]
-
-
diff --git a/template/en/default/admin/params/common.html.tmpl b/template/en/default/admin/params/common.html.tmpl
index 4941afa38..cd135e1d2 100644
--- a/template/en/default/admin/params/common.html.tmpl
+++ b/template/en/default/admin/params/common.html.tmpl
@@ -111,7 +111,7 @@
-
diff --git a/template/en/default/admin/workflow/comment.html.tmpl b/template/en/default/admin/workflow/comment.html.tmpl
index 9b447f777..8f64c77a6 100644
--- a/template/en/default/admin/workflow/comment.html.tmpl
+++ b/template/en/default/admin/workflow/comment.html.tmpl
@@ -21,7 +21,7 @@
style_urls = ['skins/standard/admin.css']
%]
-
+
File :
Enter the path to the file on your computer (or
- paste text as attachment ).
+
+ paste text as attachment ).
@@ -58,7 +67,7 @@
patch
[%# Reset this whenever the page loads so that the JS state is up to date %]
-
diff --git a/template/en/default/attachment/edit.html.tmpl b/template/en/default/attachment/edit.html.tmpl
index 43bf4c83c..d06d4ad56 100644
--- a/template/en/default/attachment/edit.html.tmpl
+++ b/template/en/default/attachment/edit.html.tmpl
@@ -219,7 +219,7 @@
View the attachment on a separate page .
[% END %]
-
-
[% ELSIF comment.collapsed %]
@@ -270,7 +270,7 @@
[% " bz_default_hidden" UNLESS comment.tags.size %]">