Background
The default Referrer Policy in all major borwsers is strict-origin-when-cross-origin, which means only the domain name is in the referral data when navigating between websites.
Historically, browsers defaulted to sharing the URL in the Referer header. This has not been the case for several years now (since 2019, 2020, or 2021 depending on the browser).
https://en.wikipedia.org/wiki/HTTP_referer
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referrer-Policy
Problem
When people follow a link on a post on Wikimedia Diff blog, no referral information is sent. The same problem happens for Wikimedia Techblog, and wikimediafoundation.org. This means our blogs are absent from referral data on other websites, as well as from our own referral data such as for Wikipedia and Commons pageviews.
I noticed this when researching T422584, through the suspicious absence of diff.wikimedia.org and such in our referral data. I traced this down to a set of 2023 changes to our WordPress configuration:
- (Oct 2023) https://github.com/wikimedia/shiro-wordpress-theme/pull/65 - A security scanner reported that soundlogo.wikimedia.org has no custom Referrer-Policy set. The theme was changed to set the most restrictive value possible: no-referrer.
- (Oct 2023) https://github.com/wikimedia/wikimedia-wordpress-security-plugin/pull/2 - Copies this instruction from the Shiro theme to a re-usable plugin.
- (Dec 2023) https://github.com/wikimedia/wikimedia-wordpress-security-plugin/pull/4 - Adds various security headers for CSP including, ironically, Referrer-Policy: strict-origin-when-cross-origin, but this is ineffective with the previous instruction also still there.
- (Dec 2023) https://github.com/wikimedia/wikimediafoundation-org/commit/8e35835475a Deployed to wikimediafoundation.org
- (Jan 2024) https://github.com/wikimedia/diff-blog/commit/76f9fb9561 Deployed to diff.wikimedia.org
It seems security scanner is unaware of the present-day default in browsers. Although to its credit, the report is neutral on what you set it to. It just wants you to be intentional. It actually points to a blog post where expert Scott Helme recommends various good choices. He does not recommend no-referrer.
When we apply the same security scanner to Wikipedia, the report makes a similar scary-red-text claim. It seems the scanner is also unaware of the meta tag <meta name="referrer" content="origin-when-cross-origin"> that MediaWiki already sets. As said, this is redundant in modern browsers. For Wikipedia, we set it redundantly to the default protect readers in older browsers from leaking what articles are being read, because the URL of a Wikipedia is in itself meaningful personal information.
Proposal
Remove the override that currenty sets the restrictive no-referrer via inc/http-headers.php in https://github.com/wikimedia/wikimedia-wordpress-security-plugin.
Keep the remaining instruction in incl/csp.php which matches the browser default strict-origin-when-cross-origin, the same way as we do on Wikipedia.
- Update the security plugin.
- Verify deployment on diff.wikimedia.org and wikimediafoundation.org.