Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/186104

Change subject: Add option to output referrer policy meta tag
......................................................................

Add option to output referrer policy meta tag

Bug: T87276
Change-Id: I9ea4797c4d292cd4565f47b88e605b4e7afdb1d1
---
M includes/DefaultSettings.php
M includes/OutputPage.php
2 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/04/186104/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index ee462d8..66f695c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -271,6 +271,16 @@
 $wgAppleTouchIcon = false;
 
 /**
+ * Value for the referrer policy meta tag.
+ * One of 'never', 'default', 'origin', 'always'. Setting it to false just
+ * prevents the meta tag from being output.
+ * See http://www.w3.org/TR/referrer-policy/ for details.
+ *
+ * @since 1.25
+ */
+$wgReferrerPolicy = false;
+
+/**
  * The local filesystem path to a temporary directory. This is not required to
  * be web accessible.
  *
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index a10946a..08575ea 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3284,6 +3284,13 @@
                        'content' => "MediaWiki $wgVersion",
                ) );
 
+               if ( $config->get( 'ReferrerPolicy' ) !== false ) {
+                       $tags['meta-referrer'] = Html::element( 'meta', array(
+                               'name' => 'referrer',
+                               'content' => $config->get( 'ReferrerPolicy')
+                       ) );
+               }
+
                $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
                if ( $p !== 'index,follow' ) {
                        // http://www.robotstxt.org/wc/meta-user.html

-- 
To view, visit https://gerrit.wikimedia.org/r/186104
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ea4797c4d292cd4565f47b88e605b4e7afdb1d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to