From c3739ba54a6a7fa2faeb8b2d314b9eab3b02b391 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Sun, 5 Feb 2017 15:59:36 -0500 Subject: [PATCH] Adds Helpful Default Values to CSP (Security Headers) & Grammar Corrections (#363) This is an amendment to #344 (the new "Security Headers" section to W3TC). Because the Content Security Policy (CSP) section can seem daunting at first for inexperienced users I felt it is important to include default values and placeholder field examples that users can rely on and use for this security feature. It makes for a better experience when using W3TC. This amendment also fixes some grammatical errors I discovered in the Security Headers section. Sorry. --- ConfigKeys.php | 12 ++++---- inc/options/browsercache.php | 56 ++++++++++++++++++------------------ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ConfigKeys.php b/ConfigKeys.php index 47d5f46..2266ca1 100644 --- a/ConfigKeys.php +++ b/ConfigKeys.php @@ -1648,23 +1648,23 @@ ), 'browsercache.security.csp.connect' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'self\'' ), 'browsercache.security.csp.font' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'self\' fonts.gstatic.com' ), 'browsercache.security.csp.script' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'self\' *.googleapis.com' ), 'browsercache.security.csp.style' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'self\' *.googleapis.com' ), 'browsercache.security.csp.img' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'self\' *.gravatar.com' ), 'browsercache.security.csp.media' => array( 'type' => 'string', @@ -1692,7 +1692,7 @@ ), 'browsercache.security.csp.default' => array( 'type' => 'string', - 'default' => '' + 'default' => '\'none\'' ), 'browsercache.other.replace' => array( 'type' => 'boolean', diff --git a/inc/options/browsercache.php b/inc/options/browsercache.php index a81a54a..fffe3ff 100644 --- a/inc/options/browsercache.php +++ b/inc/options/browsercache.php @@ -380,24 +380,24 @@ -

+

@@ -450,7 +450,7 @@ @@ -472,7 +472,7 @@ @@ -498,7 +498,7 @@ @@ -544,7 +544,7 @@ @@ -554,7 +554,7 @@ @@ -564,8 +564,8 @@ @@ -574,7 +574,7 @@ @@ -584,7 +584,7 @@ @@ -594,8 +594,8 @@ @@ -604,7 +604,7 @@ @@ -614,7 +614,7 @@ @@ -624,7 +624,7 @@ @@ -634,7 +634,7 @@ @@ -644,8 +644,8 @@ @@ -654,7 +654,7 @@ @@ -664,7 +664,7 @@ @@ -674,7 +674,7 @@ @@ -684,7 +684,7 @@
- checkbox( 'browsercache.security.session.cookie_httponly' ) ?> -
+ checkbox( 'browsercache.security.session.use_only_cookies' ) ?> +
- checkbox( 'browsercache.security.session.cookie_secure' ) ?> -
+ checkbox( 'browsercache.security.session.cookie_httponly' ) ?> +
- checkbox( 'browsercache.security.session.use_only_cookies' ) ?> -
+ checkbox( 'browsercache.security.session.cookie_secure' ) ?> +
checkbox( 'browsercache.security.xss' ) ?> -
+
checkbox( 'browsercache.security.xcto' ) ?> -
+
value="_config->get_string( 'browsercache.security.pkp.pin.backup' ) ); ?>" size="50" placeholder="Enter the Base64-Encode of the SHA256 Hash" /> -
also required and represents your backup SPKI fingerprint. This pin is any public key not in your current certificate chain and serves as backup in case your certificate expires or has to be revoked.' ); ?>
+
also required and represents your backup SPKI fingerprint. This pin is any public key not in your current certificate chain and serves as a backup in case your certificate expires or has to be revoked.' ); ?>
checkbox( 'browsercache.security.csp' ) ?> -
+
XSS attacks by allowing you to define where resources can be retrieved from, preventing browsers from loading data from any other locations. This makes it harder for an attacker to inject malicious code into your site.' ); ?>

Quick Reference Chart

value="_config->get_string( 'browsercache.security.csp.base' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.base' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.connect' ) ); ?>" size="50" /> -
+ value="_config->get_string( 'browsercache.security.csp.connect' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" /> +
value="_config->get_string( 'browsercache.security.csp.font' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.font' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.frame' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.frame' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.img' ) ); ?>" size="50" /> -
+ value="_config->get_string( 'browsercache.security.csp.img' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" /> +
value="_config->get_string( 'browsercache.security.csp.media' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.media' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.object' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.object' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.script' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.script' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.style' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.style' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />
value="_config->get_string( 'browsercache.security.csp.form' ) ); ?>" size="50" /> -
+ value="_config->get_string( 'browsercache.security.csp.form' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" /> +
value="_config->get_string( 'browsercache.security.csp.frame' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.frame' ) ); ?>" size="50" placeholder="Example: 'none'" />
value="_config->get_string( 'browsercache.security.csp.plugin' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.plugin' ) ); ?>" size="50" placeholder="Example: application/x-shockwave-flash" />
value="_config->get_string( 'browsercache.security.csp.sandbox' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.sandbox' ) ); ?>" size="50" placeholder="Example: allow-popups" />
value="_config->get_string( 'browsercache.security.csp.default' ) ); ?>" size="50" /> + value="_config->get_string( 'browsercache.security.csp.default' ) ); ?>" size="50" placeholder="Example: 'self' 'unsafe-inline' *.domain.com" />