Skip to content

Commit e524850

Browse files
committed
UPGRADE: Describe a 'return=secure-representation' preference.
1 parent 248456d commit e524850

File tree

2 files changed

+183
-31
lines changed

2 files changed

+183
-31
lines changed

specs/upgrade/index.html

Lines changed: 111 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<h1 class="p-name no-ref" id="title">Upgrade Insecure Requests</h1>
7272

7373
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft,
74-
<time class="dt-updated" datetime="2015-02-11">11 February 2015</time></span></h2>
74+
<time class="dt-updated" datetime="2015-02-13">13 February 2015</time></span></h2>
7575

7676
<div data-fill-with="spec-metadata">
7777
<dl>
@@ -175,7 +175,13 @@ <h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="cont
175175
<li><a href="#upgrading"><span class="secno">3</span> <span class="content">Upgrading Insecure Resource Requests</span></a>
176176
<ul class="toc">
177177
<li><a href="#delivery"><span class="secno">3.1</span> <span class="content">Upgrade Policy Delivery</span></a>
178-
<li><a href="#nesting"><span class="secno">3.2</span> <span class="content">Policy Inheritance</span></a>
178+
<li><a href="#feature-detect"><span class="secno">3.2</span> <span class="content">Feature Detecting Clients Capable of Upgrading</span></a>
179+
<ul class="toc">
180+
<li><a href="#preference"><span class="secno">3.2.1</span> <span class="content">
181+
The <code>return=secure-representation</code> Preference
182+
</span></a>
183+
</ul>
184+
<li><a href="#nesting"><span class="secno">3.3</span> <span class="content">Policy Inheritance</span></a>
179185
</ul>
180186
<li><a href="#algorithms"><span class="secno">4</span> <span class="content">Processing Algorithms</span></a>
181187
<ul class="toc">
@@ -478,13 +484,17 @@ <h3 class="heading settled" data-level="2.2" id="terms-defined-by-reference"><sp
478484

479485

480486
<dt data-md="">
481-
<p><code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#request">Request</a></code>'s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-url">url</a></code>, <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-client">client</a></code>, <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context">context</a></code>, and <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context-frame-type">context-frame-type</a></code> attributes.</p>
487+
<p><code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#request">Request</a></code>'s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-url">url</a></code>, <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-client">client</a></code>, <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context">context</a></code>, <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-header-list">header-list</a></code>, and <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context-frame-type">context-frame-type</a></code> attributes.</p>
482488

483489

484490
<dt data-md="">
485491
<p><a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#fetching">fetching</a></p>
486492

487493

494+
<dt data-md="">
495+
<p>The <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-header-list-append">append <var>header</var> to a <var>header list</var></a> algorithm</p>
496+
497+
488498
<dd data-md="">
489499
<p>Defined in <a data-link-type="biblio" href="#biblio-fetch">[FETCH]</a></p>
490500

@@ -595,6 +605,23 @@ <h3 class="heading settled" data-level="2.2" id="terms-defined-by-reference"><sp
595605

596606

597607

608+
</dl>
609+
610+
611+
<dl>
612+
<dt data-md="">
613+
<p>The <code><a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7240#section-2">Prefer</a></code> HTTP request header</p>
614+
615+
616+
<dt data-md="">
617+
<p>The <code><a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7240#section-4.2">return</a></code> preference</p>
618+
619+
620+
<dd data-md="">
621+
<p>Defined in <a data-link-type="biblio" href="#biblio-rfc7240">[RFC7240]</a></p>
622+
623+
624+
598625
</dl>
599626

600627

@@ -683,7 +710,55 @@ <h3 class="heading settled" data-level="3.1" id="delivery"><span class="secno">3
683710
</div>
684711

685712

686-
<h3 class="heading settled" data-level="3.2" id="nesting"><span class="secno">3.2. </span><span class="content">Policy Inheritance</span><a class="self-link" href="#nesting"></a></h3>
713+
<h3 class="heading settled" data-level="3.2" id="feature-detect"><span class="secno">3.2. </span><span class="content">Feature Detecting Clients Capable of Upgrading</span><a class="self-link" href="#feature-detect"></a></h3>
714+
715+
716+
<p>If a site requires the upgrade mechanism described in this document in order
717+
to provide users with a reasonable experience over secure transit, then
718+
authors need to determine whether or not it is safe to redirect a client to
719+
the secure version of a site. Rather than relying on user-agent sniffing to
720+
make this decision, user agents MUST advertise their capabilities when
721+
making insecure navigational requests by sending a <code>Prefer</code> HTTP
722+
request header expressing the desire for a secure representation <a data-link-type="biblio" href="#biblio-rfc7240">[RFC7240]</a>
723+
as described in <a href="#preference">§3.2.1
724+
The return=secure-representation Preference
725+
</a>.</p>
726+
727+
728+
<h4 class="heading settled" data-level="3.2.1" id="preference"><span class="secno">3.2.1. </span><span class="content">
729+
The <code>return=secure-representation</code> Preference
730+
</span><a class="self-link" href="#preference"></a></h4>
731+
732+
733+
<p>The "<code><dfn data-dfn-type="dfn" data-noexport="" id="returnsecure_representation">return=secure-representation<a class="self-link" href="#returnsecure_representation"></a></dfn></code>" preference
734+
indicates that the client prefers that the server redirect from an insecure
735+
resource representation to a secure one, and that it can successfully handle
736+
the <code><a data-link-type="dfn" href="#upgrade_insecure_requests">upgrade-insecure-requests</a></code> directive in order to make
737+
that redirection as seamless as possible.</p>
738+
739+
740+
<p>This new preference changes the <code><a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7240#section-4.2">return</a></code> ABNF defined in
741+
<a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7240#section-4.2">RFC7240 Section 4.2</a> to the following:</p>
742+
743+
744+
<pre>return = "return" BWS "=" BWS ( "secure-representation" / "representation" / "minimal" )
745+
</pre>
746+
747+
748+
<p>When a server encounters this preference in an HTTP request’s headers, it
749+
SHOULD redirect the user to a secure version of the resource being requested.</p>
750+
751+
752+
<p>User agent implementation details are described in step #2 of the the
753+
<a href="#upgrade-request">§4.1
754+
Upgrade request to a potentially secure URL, if appropriate
755+
</a> algorithm. Note in particular that to mitigate the risk
756+
that this header will become a vestigial part of the platform, user agents
757+
SHOULD omit the preference when making requests to <a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/mixedcontent/#potentially-secure-origin">potentially secure
758+
origins</a>.</p>
759+
760+
761+
<h3 class="heading settled" data-level="3.3" id="nesting"><span class="secno">3.3. </span><span class="content">Policy Inheritance</span><a class="self-link" href="#nesting"></a></h3>
687762

688763

689764
<p>If a <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/dom/#interface-document">Document</a></code>'s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/webappapis.html#incumbent-settings-object">incumbent settings object</a>’s <a data-link-type="dfn" href="#upgrade-insecure-resource-requests-flag">upgrade insecure
@@ -727,19 +802,37 @@ <h3 class="heading settled" data-level="4.1" id="upgrade-request"><span class="s
727802

728803
<p>Given a <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#request">Request</a></code> <var>request</var>, this algorithm will rewrite its
729804
<code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-url">url</a></code> if the <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-client">client</a></code> from which the request originates
730-
has opted-in to upgrades.</p>
805+
has opted-in to upgrades. It will also inject a
806+
<code><a data-link-type="dfn" href="#returnsecure_representation">return=secure-representation</a></code> preference for insecure
807+
navigational requests in order to improve a server’s ability to feature-detect
808+
a client’s upgrade capabilities.</p>
731809

732810

733-
<p>We will not upgrade navigational requests, with the exception of form
734-
submissions. Form submissions will be upgraded to mitigate the risk of data
735-
leakage via plaintext submissions.</p>
811+
<p>We will not upgrade cross-origin navigational requests, with the exception of
812+
form submissions. Form submissions will be upgraded to mitigate the risk of
813+
data leakage via plaintext submissions.</p>
736814

737815

738816
<p class="issue" id="issue-3615b173"><a class="self-link" href="#issue-3615b173"></a>This should be called from Fetch, probably after the existing step #3.</p>
739817

740818

741819
<ol>
742820

821+
<li>
822+
If <var>request</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-url">url</a></code> is <a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/mixedcontent/#potentially-secure-origin">potentially secure</a>:
823+
return without modifying <var>request</var>.
824+
825+
826+
827+
<li>
828+
If <var>request</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context-frame-type">context-frame-type</a></code> is
829+
<code>top-level</code>, <code>nested</code>, or <code>auxiliary</code>,
830+
then <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-header-list-append">append</a> a header named <code>Prefer</code> with a value
831+
of <code><a data-link-type="dfn" href="#returnsecure_representation">return=secure-representation</a></code> to
832+
<var>request</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-header-list">header-list</a></code>.
833+
834+
835+
743836
<li>
744837
If <var>request</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-context-frame-type">context-frame-type</a></code> is
745838
<code>top-level</code> or <code>auxiliary</code>, then:
@@ -764,9 +857,9 @@ <h3 class="heading settled" data-level="4.1" id="upgrade-request"><span class="s
764857
<p class="note" role="note">Note: We allow only same-origin upgrades in order to ensure that
765858
navigations between pages of a single site that has opted-into
766859
the upgrade behavior remain on HTTPS, regardless of the hard-coded
767-
values in &lt;a> tags. Performing upgrades for third-party
768-
resources brings a significantly higher potential for breakage, so
769-
we’re avoiding it for the moment.</p>
860+
values in &lt;a> tags. Performing upgrades for navigations to
861+
third-party resources brings a significantly higher potential for
862+
breakage, so we’re avoiding it for the moment.</p>
770863

771864

772865

@@ -778,7 +871,7 @@ <h3 class="heading settled" data-level="4.1" id="upgrade-request"><span class="s
778871

779872

780873
<li>
781-
Return without modifying <var>request</var>.
874+
Return without further modifying <var>request</var>.
782875

783876

784877

@@ -787,12 +880,6 @@ <h3 class="heading settled" data-level="4.1" id="upgrade-request"><span class="s
787880

788881

789882

790-
<li>
791-
If <var>request</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-url">url</a></code> is <a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/mixedcontent/#potentially-secure-origin">potentially secure</a>,
792-
return without modifying <var>request</var>.
793-
794-
795-
796883
<li>
797884
Let <var>upgrade state</var> be the result of executing
798885
<a href="#should-upgrade-for-client">§4.2
@@ -891,7 +978,7 @@ <h3 class="heading settled" data-level="4.2" id="should-upgrade-for-client"><spa
891978

892979
<p class="note" role="note">Note: This catches requests triggered from detached <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-request-client">client</a></code>s.
893980
Not sure this is necessary, really, given the inheritance structure
894-
defined in <a href="#nesting">§3.2 Policy Inheritance</a>.</p>
981+
defined in <a href="#nesting">§3.3 Policy Inheritance</a>.</p>
895982

896983

897984

@@ -917,7 +1004,7 @@ <h3 class="heading settled" data-level="4.3" id="report-an-upgrade"><span class=
9171004
<p class="note" role="note">Note: This violation report will be triggered for the <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/dom/#interface-document">Document</a></code> or
9181005
<code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/workers/#worker">Worker</a></code> that triggers the request. This might or might not be the same
9191006
<a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/content-security-policy/#protected-resource">protected resource</a> that set the
920-
<code><a data-link-type="dfn" href="#upgrade_insecure_requests">upgrade-insecure-requests</a></code> directive, due to <a href="#nesting">§3.2 Policy Inheritance</a>.
1007+
<code><a data-link-type="dfn" href="#upgrade_insecure_requests">upgrade-insecure-requests</a></code> directive, due to <a href="#nesting">§3.3 Policy Inheritance</a>.
9211008
See <a href="#violation-report-target">§6.2 CSP Violation Reports</a> for detail.</p>
9221009

9231010

@@ -1053,7 +1140,7 @@ <h3 class="heading settled" data-level="6.2" id="violation-report-target"><span
10531140
target the <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/dom/#interface-document">Document</a></code> or <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/workers/#worker">Worker</a></code> that triggered the request, rather
10541141
than the <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/dom/#interface-document">Document</a></code> or <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/workers/#worker">Worker</a></code> on which the
10551142
<code><a data-link-type="dfn" href="#upgrade_insecure_requests">upgrade-insecure-requests</a></code> directive was set. Due to
1056-
<a href="#nesting">§3.2 Policy Inheritance</a>, the latter might be a cross-origin ancestor of the former, and
1143+
<a href="#nesting">§3.3 Policy Inheritance</a>, the latter might be a cross-origin ancestor of the former, and
10571144
sending violation reports to that set of reporting endpoints could leak data
10581145
in unexpected ways.</p>
10591146

@@ -1240,6 +1327,8 @@ <h3 class="no-num heading settled" id="normative"><span class="content">Normativ
12401327
<dd>Robin Berjon; et al. <a href="http://www.w3.org/TR/html5/">HTML5</a>. 28 October 2014. REC. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a>
12411328
<dt id="biblio-rfc2119"><a class="self-link" href="#biblio-rfc2119"></a>[rfc2119]
12421329
<dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
1330+
<dt id="biblio-rfc7240"><a class="self-link" href="#biblio-rfc7240"></a>[rfc7240]
1331+
<dd>J. Snell. <a href="http://www.ietf.org/rfc/rfc7240.txt">Prefer Header for HTTP</a>. June 2014. Proposed Standard. URL: <a href="http://www.ietf.org/rfc/rfc7240.txt">http://www.ietf.org/rfc/rfc7240.txt</a>
12431332
<dt id="biblio-workers"><a class="self-link" href="#biblio-workers"></a>[workers]
12441333
<dd>Ian Hickson. <a href="http://www.w3.org/TR/workers/">Web Workers</a>. 1 May 2012. CR. URL: <a href="http://www.w3.org/TR/workers/">http://www.w3.org/TR/workers/</a></dl>
12451334
<h3 class="no-num heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
@@ -1256,6 +1345,7 @@ <h2 class="no-num heading settled" id="index"><span class="content">Index</span>
12561345
<ul class="indexlist">
12571346
<li>conformant server, <a href="#conformant-server">Unnumbered section</a>
12581347
<li>conformant user agent, <a href="#conformant-user-agent">Unnumbered section</a>
1348+
<li>return=secure-representation, <a href="#returnsecure_representation">3.2.1</a>
12591349
<li>upgrade, <a href="#upgrade">2.1</a>
12601350
<li>upgrade-insecure-requests, <a href="#upgrade_insecure_requests">3.1</a>
12611351
<li>upgrade insecure resource requests

0 commit comments

Comments
 (0)