<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>127172</bug_id>
          
          <creation_ts>2014-01-17 06:01:13 -0800</creation_ts>
          <short_desc>Never send a non-http(s) referrer header even with a referrer policy</short_desc>
          <delta_ts>2014-01-20 11:49:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>jochen</reporter>
          <assigned_to>jochen</assigned_to>
          <cc>ap</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>969121</commentid>
    <comment_count>0</comment_count>
    <who name="">jochen</who>
    <bug_when>2014-01-17 06:01:13 -0800</bug_when>
    <thetext>Never send a non-http(s) referrer header even with a referrer policy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969123</commentid>
    <comment_count>1</comment_count>
      <attachid>221460</attachid>
    <who name="">jochen</who>
    <bug_when>2014-01-17 06:02:56 -0800</bug_when>
    <thetext>Created attachment 221460
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969124</commentid>
    <comment_count>2</comment_count>
    <who name="">jochen</who>
    <bug_when>2014-01-17 06:03:38 -0800</bug_when>
    <thetext>Alexey, can you have a look please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969153</commentid>
    <comment_count>3</comment_count>
      <attachid>221460</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2014-01-17 09:37:28 -0800</bug_when>
    <thetext>Comment on attachment 221460
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221460&amp;action=review

It&apos;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.

&gt; Source/WebCore/page/SecurityPolicy.cpp:75
&gt; +    if (!protocolIs(referrer, &quot;http&quot;) &amp;&amp; !protocolIs(referrer, &quot;https&quot;))
&gt; +        return String();

This should use url.protocolIsInHTTPFamily().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969747</commentid>
    <comment_count>4</comment_count>
    <who name="">jochen</who>
    <bug_when>2014-01-20 00:34:09 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 221460 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=221460&amp;action=review
&gt; 
&gt; It&apos;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()

&gt; 
&gt; 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&apos;s not using the string as referrer header, i&apos;m not sure what to do here. Even if the policy is default, the Ping-From field won&apos;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.


&gt; 
&gt; This patch is an improvement, r=me.
&gt; 
&gt; &gt; Source/WebCore/page/SecurityPolicy.cpp:75
&gt; &gt; +    if (!protocolIs(referrer, &quot;http&quot;) &amp;&amp; !protocolIs(referrer, &quot;https&quot;))
&gt; &gt; +        return String();
&gt; 
&gt; This should use url.protocolIsInHTTPFamily().

That means converting referrer to a KURL, is that ok with you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969846</commentid>
    <comment_count>5</comment_count>
      <attachid>221460</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2014-01-20 08:22:44 -0800</bug_when>
    <thetext>Comment on attachment 221460
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221460&amp;action=review

&gt;&gt;&gt; Source/WebCore/page/SecurityPolicy.cpp:75
&gt;&gt;&gt; +        return String();
&gt;&gt; 
&gt;&gt; This should use url.protocolIsInHTTPFamily().
&gt; 
&gt; That means converting referrer to a KURL, is that ok with you?

You are right, let&apos;s keep it as is then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969860</commentid>
    <comment_count>6</comment_count>
      <attachid>221460</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-01-20 08:58:30 -0800</bug_when>
    <thetext>Comment on attachment 221460
Patch

Clearing flags on attachment: 221460

Committed r162351: &lt;http://trac.webkit.org/changeset/162351&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969861</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-01-20 08:58:32 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969946</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-01-20 11:49:45 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; (From update of attachment 221460 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=221460&amp;action=review
&gt; 
&gt; &gt;&gt;&gt; Source/WebCore/page/SecurityPolicy.cpp:75
&gt; &gt;&gt;&gt; +        return String();
&gt; &gt;&gt; 
&gt; &gt;&gt; This should use url.protocolIsInHTTPFamily().
&gt; &gt; 
&gt; &gt; That means converting referrer to a KURL, is that ok with you?
&gt; 
&gt; You are right, let&apos;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.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>221460</attachid>
            <date>2014-01-17 06:02:56 -0800</date>
            <delta_ts>2014-01-20 08:58:30 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-127172-20140117150254.patch</filename>
            <type>text/plain</type>
            <size>1548</size>
            <attacher>jochen</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTYyMTk3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggYTlmY2MwMTJlMjYzM2Qz
NDBkZmVkNTRjMDQ5OTgwNGUwNDQ2NWU3Mi4uOWE4MzdjYWQyNTBiMWVlOTZiMDNlNTY1NTk2Mzkw
Y2RjNGU0ZWIxMSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBACisyMDE0LTAxLTE3ICBKb2No
ZW4gRWlzaW5nZXIgIDxqb2NoZW5AY2hyb21pdW0ub3JnPgorCisgICAgICAgIE5ldmVyIHNlbmQg
YSBub24taHR0cChzKSByZWZlcnJlciBoZWFkZXIgZXZlbiB3aXRoIGEgcmVmZXJyZXIgcG9saWN5
CisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xMjcxNzIK
KworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PU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