Skip to content

Commit

Permalink
Add referrer CSP and <meta> tag
Browse files Browse the repository at this point in the history
This avoids leaking Referer header in modern browsers.

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Jun 20, 2016
1 parent be3ecbb commit 1e5716c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ public function sendHttpHeaders()
. $captcha_url
. $GLOBALS['cfg']['CSPAllow']
. ";"
. "referrer no-referrer;"
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. $map_tile_urls
Expand All @@ -561,6 +562,7 @@ public function sendHttpHeaders()
. $captcha_url
. $GLOBALS['cfg']['CSPAllow'] . ';'
. "options inline-script eval-script;"
. "referrer no-referrer;"
. "img-src 'self' data: "
. $GLOBALS['cfg']['CSPAllow']
. $map_tile_urls
Expand All @@ -575,6 +577,7 @@ public function sendHttpHeaders()
. $captcha_url
. $GLOBALS['cfg']['CSPAllow']
. " 'unsafe-inline' 'unsafe-eval';"
. "referrer no-referrer;"
. "style-src 'self' 'unsafe-inline' "
. $captcha_url
. ';'
Expand Down Expand Up @@ -636,6 +639,7 @@ private function _getHtmlStart()
private function _getMetaTags()
{
$retval = '<meta charset="utf-8" />';
$retval .= '<meta name="referrer" content="none" />';
$retval .= '<meta name="robots" content="noindex,nofollow" />';
$retval .= '<meta http-equiv="X-UA-Compatible" content="IE=Edge">';
if (! $GLOBALS['cfg']['AllowThirdPartyFraming']) {
Expand Down

0 comments on commit 1e5716c

Please sign in to comment.