@@ -153,9 +153,9 @@ <h2 id="introduction">Introduction</h2>
153
153
server, but also pin the < em > content</ em > , ensuring that an exact representation of
154
154
a resource, and < em > only</ em > that representation, loads and executes.</ p >
155
155
156
- < p > This document specifies such a validation scheme, extending several HTML
157
- elements with an < code > integrity</ code > attribute that contains a cryptographic hash of
158
- the representation of the resource the author expects to load. For instance,
156
+ < p > This document specifies such a validation scheme, extending two HTML elements
157
+ and the < code > fetch() </ code > API with an < code > integrity</ code > attribute that contains a cryptographic hash
158
+ of the representation of the resource the author expects to load. For instance,
159
159
an author may wish to load some framework from a shared server rather than hosting it
160
160
on their own origin. Specifying that the < em > expected</ em > SHA-256 hash of
161
161
< code > https://example.com/example-framework.js</ code >
@@ -182,7 +182,7 @@ <h3 id="goals">Goals</h3>
182
182
183
183
< ol >
184
184
< li >
185
- < p > Compromise of the third-party service should not automatically mean
185
+ < p > Compromise of a third-party service should not automatically mean
186
186
compromise of every site which includes its scripts. Content authors
187
187
will have a mechanism by which they can specify expectations for
188
188
content they load, meaning for example that they could load a
@@ -362,7 +362,7 @@ <h3 id="cryptographic-hash-functions">Cryptographic hash functions</h3>
362
362
< h4 id ="agility "> Agility</ h4 >
363
363
364
364
< p > Multiple sets of < a href ="#dfn-integrity-metadata "> integrity metadata</ a > may be associated with a single
365
- resource in order to provide agility in the face of future discoveries.
365
+ resource in order to provide agility in the face of future cryptographic discoveries.
366
366
For example, the resource described in the previous section may be described
367
367
by either of the following hash expressions:</ p >
368
368
@@ -385,8 +385,8 @@ <h4 id="agility">Agility</h4>
385
385
386
386
< p > When a hash function is determined to be insecure, user agents SHOULD deprecate
387
387
and eventually remove support for integrity validation using that hash
388
- function. User agents MAY check the validity of hashes which use a deprecated
389
- function.</ p >
388
+ function. User agents MAY check the validity of responses using a digest based on
389
+ a deprecated function.</ p >
390
390
391
391
< p > To allow authors to switch to stronger hash functions without being held back by older
392
392
user agents, validation using unsupported hash functions acts like no integrity value
@@ -399,7 +399,7 @@ <h4 id="agility">Agility</h4>
399
399
< section >
400
400
< h4 id ="priority "> Priority</ h4 >
401
401
402
- < p > User agents must provide a mechanism of determining the relative priority of two
402
+ < p > User agents must provide a mechanism for determining the relative priority of two
403
403
hash functions and return the empty string if the priority is equal. That is, if
404
404
a user agent implemented a function like < dfn > getPrioritizedHashFunction(a,
405
405
b)</ dfn > it would return the hash function the user agent considers the most
@@ -451,12 +451,12 @@ <h4 id="is-response-eligible-for-integrity-validation">Is <var>response</var> el
451
451
resources accessed over a < code > file</ code > scheme URL are unlikely to be
452
452
eligible for integrity checks.</ p >
453
453
454
- < p > One should note that being a < a href ="#dfn-secure-document "> secure document</ a > (e.g. a document delivered
454
+ < p > One should note that being a < a href ="#dfn-secure-document "> secure document</ a > (e.g., a document delivered
455
455
over HTTPS) is not necessary for the use of integrity validation. Because
456
456
resource integrity is only an application level security tool, and it does not
457
457
change the security state of the user agent, a < a href ="#dfn-secure-document "> secure document</ a > is
458
- unnecessary. However, if integrity is used in other than a < a href ="#dfn-secure-document "> secure document</ a > (e.g.
459
- a document delivered over HTTP), authors should be aware that the integrity
458
+ unnecessary. However, if integrity is used in something other than a < a href ="#dfn-secure-document "> secure document</ a >
459
+ (e.g., a document delivered over HTTP), authors should be aware that the integrity
460
460
provides < em > no security guarantees at all</ em > . For this reason, authors should
461
461
only deliver integrity metadata on a < a href ="#dfn-potentially-secure-origin "> potentially secure origin</ a > . See
462
462
< a href ="#non-secure-contexts-remain-non-secure-1 "> Non-secure contexts remain non-secure</ a > for more discussion.</ p >
@@ -473,7 +473,7 @@ <h4 id="is-response-eligible-for-integrity-validation">Is <var>response</var> el
473
473
< li > Return < code > false</ code > .</ li >
474
474
</ ol >
475
475
476
- < p class ="note "> Step 3 returns < code > true</ code > if the fetch was a CORS-enabled request. If the
476
+ < p class ="note "> Step 2 returns < code > true</ code > if the fetch was a CORS-enabled request. If the
477
477
fetch failed the CORS checks, it won’t be available to us for integrity
478
478
checking because it won’t have loaded successfully.</ p >
479
479
@@ -741,7 +741,7 @@ <h4 id="handling-integrity-violations">Handling integrity violations</h4>
741
741
< a href ="#modifications-to-fetch "> Modifications to Fetch</ a > .</ p >
742
742
743
743
< p class ="note "> On a failed integrity check, an < code > error</ code > event is thrown. Developers
744
- wishing to provide a canonical fallback resource (e.g. a resource not served
744
+ wishing to provide a canonical fallback resource (e.g., a resource not served
745
745
from a CDN, perhaps from a secondary, trusted, but slower source) can catch this
746
746
< code > error</ code > event and provide an appropriate handler to replace the
747
747
failed resource with a different one.</ p >
@@ -811,8 +811,8 @@ <h2 id="security-considerations">Security Considerations</h2>
811
811
< section >
812
812
< h3 id ="non-secure-contexts-remain-non-secure "> Non-secure contexts remain non-secure</ h3 >
813
813
814
- < p > < a href ="#dfn-integrity-metadata "> Integrity metadata</ a > delivered to a context that is not a < a href ="#dfn-secure-context "> secure context</ a > ,
815
- such as an only protects an origin against a compromise of the
814
+ < p > < a href ="#dfn-integrity-metadata "> Integrity metadata</ a > delivered by a context that is not a < a href ="#dfn-secure-context "> secure context</ a > ,
815
+ such as an HTTP page, only protects an origin against a compromise of the
816
816
server where an external resources is hosted. Network attackers can alter the
817
817
digest in-flight (or remove it entirely, or do absolutely anything else to the
818
818
document), just as they could alter the response the hash is meant to validate.
@@ -854,7 +854,7 @@ <h3 id="cross-origin-data-leakage">Cross-origin data leakage</h3>
854
854
< p > Moreover, attackers can brute-force specific values in an otherwise
855
855
static resource: consider a JSON response that looks like this:</ p >
856
856
857
- < pre class ="example "> < code > {'status': 'authenticated', 'username': 'Stephan Falken '}
857
+ < pre class ="example "> < code > {'status': 'authenticated', 'username': 'admin '}
858
858
</ code > </ pre >
859
859
860
860
< p > An attacker can precompute hashes for the response with a variety of
@@ -874,8 +874,9 @@ <h2 id="acknowledgements">Acknowledgements</h2>
874
874
Markham’s < a href ="http://www.gerv.net/security/link-fingerprints/ "> Link Fingerprints</ a > concept, as well as WHATWG’s < a href ="https://wiki.whatwg.org/wiki/Link_Hashes "> Link Hashes</ a > .</ p >
875
875
876
876
< p > A special thanks to Mike West of Google, Inc. for his invaluable contributions
877
- to the initial version of this spec. Additonally, Brad Hill, Anne van Kesteren, Mark Nottingham,
878
- Dan Veditz, Eduardo Vela, Tanvi Vyas, and Michal Zalewski provided invaluable feedback.</ p >
877
+ to the initial version of this spec. Additonally, Brad Hill, Anne van Kesteren,
878
+ Jonathan Kingston, Mark Nottingham, Dan Veditz, Eduardo Vela, Tanvi Vyas, and
879
+ Michal Zalewski provided invaluable feedback.</ p >
879
880
880
881
</ section >
881
882
0 commit comments