- Security. Despite copious warnings, developers often include secrets in URLs. For example, to prevent Cross-Site Request Forgery (CSRF), developers often use secret tokens, which have a nasty habit of leaking into URLs and then into Referer headers sent to other sites.
- Privacy. The Referer header is even worse for privacy, for example, leaking search terms from your favorite search engine to the web sites you visit. As another example, Facebook accidentally leaked user identities to advertisers via the Referer header.
As a first step, I wrote up a short proposal for a mechanism web sites can use to suppress or truncate the Referer header:
<meta name="referrer" content="never">One subtlety in the design is including the "always" option. The main reason to include this option is to make it easier for us to later block the Referer header by default. The always options gives sites an escape valve to turn the Referer header back on, if needed.
<meta name="referrer" content="origin">
This mechanism is now implemented in WebKit and will hopefully be implemented in Firefox and other browsers soon.
It seems to me that the https behavior for always violates the least astonishment for developers.
ReplyDeleteAdditionally, not sure if this is a resource level property (thus implemented at the document) or a web application level property (thus implemented maybe via CSP that can be set by the web application admin).
Yeah, we'll probably want to add a directive to CSP to control this policy. That's probably something good to consider for CSP 1.1. Please feel encouraged to add it to this wiki page:
ReplyDeletehttp://www.w3.org/Security/wiki/Content_Security_Policy
Ironically, people also use Referer header fields to defend against CSRF.
ReplyDeleteAlso, maybe spelling it correctly here (as opposed to the header field name) will cause unnecessary confusion... (maybe this is a case where both need to be allowed?)
ReplyDeleteTypically, we spell it correctly when we refer to it in the DOM. For example, noreferrer and document.referrer both spell it correctly.
ReplyDeleteSome people use it against hot linking.
ReplyDeleteI noticed that "never" and "always" answer to the question "when?", but "origin" answers to "what?".
ReplyDeleteShouldn't it be something like "none", "origin" and "full"? Or maybe "no", "yes" and "origin".
Nice stuff !
ReplyDelete