Bug 127172

Summary: Never send a non-http(s) referrer header even with a referrer policy
Product: WebKit Reporter: jochen
Component: New BugsAssignee: jochen
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

jochen
Reported 2014-01-17 06:01:13 PST
Never send a non-http(s) referrer header even with a referrer policy
Attachments
Patch (1.51 KB, patch)
2014-01-17 06:02 PST, jochen
no flags
jochen
Comment 1 2014-01-17 06:02:56 PST
jochen
Comment 2 2014-01-17 06:03:38 PST
Alexey, can you have a look please?
Alexey Proskuryakov
Comment 3 2014-01-17 09:37:28 PST
Comment on attachment 221460 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221460&action=review It's not cool to have a function with such an ambitious name as shouldHideReferrer, and then have it explained in a header comment what it actually means (that being, do the same thing generateReferrerHeader(ReferrerPolicyDefault), but with a murky restriction of not using the result for Referrer header sending!) There is only one call site outside SecurityPolicy, and that looks incorrect, as it actually blocks Referer header regardless of policy if shouldHideReferrer said so. This patch is an improvement, r=me. > Source/WebCore/page/SecurityPolicy.cpp:75 > + if (!protocolIs(referrer, "http") && !protocolIs(referrer, "https")) > + return String(); This should use url.protocolIsInHTTPFamily().
jochen
Comment 4 2014-01-20 00:34:09 PST
(In reply to comment #3) > (From update of attachment 221460 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=221460&action=review > > It's not cool to have a function with such an ambitious name as shouldHideReferrer, and then have it explained in a header comment what it actually means (that being, do the same thing generateReferrerHeader(ReferrerPolicyDefault), but with a murky restriction of not using the result for Referrer header sending!) Agreed. The ping loader should probably just use generateReferrerHeader() > > There is only one call site outside SecurityPolicy, and that looks incorrect, as it actually blocks Referer header regardless of policy if shouldHideReferrer said so. Since it's not using the string as referrer header, i'm not sure what to do here. Even if the policy is default, the Ping-From field won't be cleared on a https to http transition in the network stack. The most reasonable thing to do would be to change the standard to use the referrer header instead of a Ping-From header. > > This patch is an improvement, r=me. > > > Source/WebCore/page/SecurityPolicy.cpp:75 > > + if (!protocolIs(referrer, "http") && !protocolIs(referrer, "https")) > > + return String(); > > This should use url.protocolIsInHTTPFamily(). That means converting referrer to a KURL, is that ok with you?
Alexey Proskuryakov
Comment 5 2014-01-20 08:22:44 PST
Comment on attachment 221460 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221460&action=review >>> Source/WebCore/page/SecurityPolicy.cpp:75 >>> + return String(); >> >> This should use url.protocolIsInHTTPFamily(). > > That means converting referrer to a KURL, is that ok with you? You are right, let's keep it as is then.
WebKit Commit Bot
Comment 6 2014-01-20 08:58:30 PST
Comment on attachment 221460 [details] Patch Clearing flags on attachment: 221460 Committed r162351: <http://trac.webkit.org/changeset/162351>
WebKit Commit Bot
Comment 7 2014-01-20 08:58:32 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 8 2014-01-20 11:49:45 PST
(In reply to comment #5) > (From update of attachment 221460 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=221460&action=review > > >>> Source/WebCore/page/SecurityPolicy.cpp:75 > >>> + return String(); > >> > >> This should use url.protocolIsInHTTPFamily(). > > > > That means converting referrer to a KURL, is that ok with you? > > You are right, let's keep it as is then. We should create a string version of the protocolIsInHTTPFamily function, for the same reason we have a URL version.
Note You need to log in before you can comment on or make changes to this bug.