From cdcd923375fd9f2c55221812e96c01f6dcd25e1b Mon Sep 17 00:00:00 2001 From: luccioman Date: Tue, 28 Feb 2017 18:11:54 +0100 Subject: [PATCH] Privacy enhancement : added settings to control referrer policy. HTTP "Referer" header sent by the browser when using YaCy can now be controlled either with the referrer meta tag as a global policy, or only for search result links by adding the attribute rel="noreferrer". To improve privacy with the less possible regressions, the default is set as meta tag with value "origin-when-cross-origin" : internal YaCy links behavior is not affected, but when visiting external websites referrer url is not empty but stripped from query parameters and path. Older browsers, Safari, MS IE and Edge do not support the referrer meta tag, so the standard but less flexible noreferrer link type can also be enabled as an alternative. User-friendly settings page to be implemented. --- defaults/yacy.init | 12 ++++++++++++ htroot/env/templates/metas.template | 1 + htroot/yacysearchitem.html | 12 ++++++------ htroot/yacysearchitem.java | 9 +++++++-- .../net/yacy/http/servlets/YaCyDefaultServlet.java | 1 + source/net/yacy/search/SwitchboardConstants.java | 12 ++++++++++++ 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/defaults/yacy.init b/defaults/yacy.init index 6d978fc68..2aa3109e3 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -89,6 +89,12 @@ server.maxTrackingCount = 1000 # maximum number of hosts that are tracked server.maxTrackingHostCount = 100 +# Global HTTP Referrer policy delivered by meta tag (see https://www.w3.org/TR/referrer-policy/ for available policies) +# Can be left empty : the browser should then fallback to the default "no-referrer-when-downgrade" policy +# Be careful, some policies will also affect YaCy internal links : "no-referrer", "same-origin", "origin" and "strict-origin". This can be useful +# for example when proxyURL.useforresults is set to true, to control the referrer information initially sent by YaCy proxy when visiting search results +referrer.meta.policy=origin-when-cross-origin + # maximum file sizes: since some users experience problems with too large files # the file size of database files can be limited. Larger files can be used to get a # better IO performance and to use less RAM; however, if the size must be limited @@ -834,6 +840,12 @@ search.target = _self search.target.special = _self search.target.special.pattern = +# When true, override the global referrer.meta.policy value and add the standard noreferrer link type to search results links : +# this instructs the browser that it should not send any referrer information at all when visiting them +# Be careful : some websites might reject requests with no referrer +# Supported by more browsers than the meta referrer tag +search.result.noreferrer=false + # search result lines may show additional information for each search hit # these information pieces may be switched on or off search.result.show.date = true diff --git a/htroot/env/templates/metas.template b/htroot/env/templates/metas.template index bc5ce7a10..30e62e4d9 100644 --- a/htroot/env/templates/metas.template +++ b/htroot/env/templates/metas.template @@ -4,6 +4,7 @@ + diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html index ef08933f4..73d08678c 100644 --- a/htroot/yacysearchitem.html +++ b/htroot/yacysearchitem.html @@ -4,7 +4,7 @@ #(favicon)#:: #(/favicon)# - #[title]# + #[title]#
#(heuristic)#:: heuristic:#[name]# (redundant):: @@ -24,7 +24,7 @@ #(/authorized)#

#[description]#

-

#[urlname]#

+

#[urlname]#

#(showDate)#::#[date]##(/showDate)# #(showEvent)#::on #[date]##(/showEvent)# @@ -45,14 +45,14 @@ #[name]# -

#[name]#
#[sourcedom]#
+
#[name]#
#[sourcedom]#
#(/item)# :: - #(item)#::#[name]##[hrefshort]##(/item)# + #(item)#::#[name]##[hrefshort]##(/item)# :: - #(item)#::#[name]##[hrefshort]##(/item)# + #(item)#::#[name]##[hrefshort]##(/item)# :: - #(item)#::#[name]##[hrefshort]##(/item)# + #(item)#::#[name]##[hrefshort]##(/item)# #(/content)#