Hi Dylan,
When you launch Google Developer tools, under Network, you have to click on https://www.resurrectedhair.net not the resurrectedhair.net since I set up a redirect rule with Cloudflare to redirect all traffic to www.
You’ll see the CSP header. If I set the CSP to report only it changes to content-security-policy-report-only: …
What I ended up doing was disabling all features and only kept CSP as report only. I disabled my apache security.conf file since it originally had the X-Content-Type-Options, X-Frame-Options, and X-XSS-Protection enabled. I also cleared CLoudflare’s and browser’s cache.
Here are my observations:
1) Navigating to: https://securityheaders.io/?q=https%3A%2F%2Fwww.resurrectedhair.net shows a D score. Red flags are CSP, X-Frame Options, X-XSS Protection, and Referrer-Policy. Note, if I enable my apache security.conf file, X-Frame Options and X-XSS Protection will show up as green flags because I manually configured that file to include those headers. Same holds true if I decide to manually include syntax for CSP and Referrer-Policy.
Again, if I disable security.conf and enable X-Frame Options as SameOrigin and X-XSS Protection as 1; mode=block in your plugin, I still get red flags and a D score for both these headers. Results are the same either on Report only or Enforce policies mode.
2) If security.conf is disabled and CSP mode is set to either report or enforce policies, if I enable X-Frame Options and X-XSS-Protection using your plugin, Google developer tools will show that these two headers are correctly enabled. But, again, these items show up as red flags using https://securityheaders.io. One million dollar question: Why the discrepancy? Who’s telling the truth?
3) I have manually included the X-Content-Type-Options: “nosniff” syntax in my security.conf file. Whether this file is enabled or not, https://securityheaders.io shows a green flag indicating that the value is set to “nosniff” even if I disable the security.conf. I am restarting apache2 otherwise the security.conf will not be properly disabled. Bear in mind, I have not enabled X-Content-Type-Options in your plugin’s settings but yet I still get a notification from securityheaders.io that’s on.
Google developer tools also shows it set to “no sniff”. Could it be Google automatically preloads this header in its browser?
4) Referrer policy shows as a red flag (disabled) using securityheaders.io but Google developer tools shows Referrer Policy is on set to its default value: no-referrer-when-downgrade. It doesn’t matter if this setting is disabled or enabled in your plugin. However, if I enable security.conf and manually set a value for this header, securityheaders.io shows I have it enabled as a green flag.
In summary:
CSP, X-Frame Options, X-XSS-Protection, and Referrer-Policy on securityheaders.io are strictly and directly driven by my security.conf file. If I set these values “on”, the red flags dissipate and I get a better score. On the contrary, setting them “off”, produces the complete opposite effect.
Turning on X-Frame Options and X-XSS-Protection in your plugin shows that these headers are enabled in Google Developer tools but turned off using securityheaders.io
X-Content-Type-Options always shows up as enabled on securityheaders.io and Google developer tools regardless if this setting is turned on or off in security.conf or the plugin’s settings.
Lastly, referrer policy shows up as disabled on securityheaders.io but enabled using Google developer tools regardless if this header is enabled or disabled in your plugin’s settings. However, if I enable security.conf, securityheaders.io shows that this header is enabled.
WP-admin:
If I run Google Developer tools when I am logged in WP, I am not sure if I am looking in the right section, but when I click on WP_CSP_Admin.js or WP_CSP_Admin.css I don’t see CSP as a header whether the mode is set to report only or enforce policies.
Sorry for the lengthy response. I am just trying to get to the bare bottom of this paradox.
Thanks Dylan for taking the time to read my inquiries and conscientiously following up. It does truly mean a lot! Sorry to be a nuisance!
All my best,
Joe