Skip to content

Commit 5b3e627

Browse files
committed
Merge pull request #431 from fmarier/sri-review-francois
SRI: Francois' review of the spec
2 parents ec982b7 + cf6d4b1 commit 5b3e627

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

specs/subresourceintegrity/spec.markdown

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ impunity. Ideally, authors would not only be able to pin the keys of a
2929
server, but also pin the _content_, ensuring that an exact representation of
3030
a resource, and _only_ that representation, loads and executes.
3131

32-
This document specifies such a validation scheme, extending several HTML
33-
elements with an `integrity` attribute that contains a cryptographic hash of
34-
the representation of the resource the author expects to load. For instance,
32+
This document specifies such a validation scheme, extending two HTML elements
33+
and the `fetch()` API with an `integrity` attribute that contains a cryptographic hash
34+
of the representation of the resource the author expects to load. For instance,
3535
an author may wish to load some framework from a shared server rather than hosting it
3636
on their own origin. Specifying that the _expected_ SHA-256 hash of
3737
`https://example.com/example-framework.js`
@@ -60,7 +60,7 @@ and future versions of the specification are likely to expand this coverage.
6060
<section>
6161
### Goals
6262

63-
1. Compromise of the third-party service should not automatically mean
63+
1. Compromise of a third-party service should not automatically mean
6464
compromise of every site which includes its scripts. Content authors
6565
will have a mechanism by which they can specify expectations for
6666
content they load, meaning for example that they could load a
@@ -243,7 +243,7 @@ request's [integrity metadata][], and MAY support additional hash functions.
243243
#### Agility
244244

245245
Multiple sets of [integrity metadata][] may be associated with a single
246-
resource in order to provide agility in the face of future discoveries.
246+
resource in order to provide agility in the face of future cryptographic discoveries.
247247
For example, the resource described in the previous section may be described
248248
by either of the following hash expressions:
249249

@@ -264,8 +264,8 @@ set][get-the-strongest]" algorithms).
264264

265265
When a hash function is determined to be insecure, user agents SHOULD deprecate
266266
and eventually remove support for integrity validation using that hash
267-
function. User agents MAY check the validity of hashes which use a deprecated
268-
function.
267+
function. User agents MAY check the validity of responses using a digest based on
268+
a deprecated function.
269269

270270
To allow authors to switch to stronger hash functions without being held back by older
271271
user agents, validation using unsupported hash functions acts like no integrity value
@@ -277,7 +277,7 @@ stronger hash functions as they become available.
277277
<section>
278278
#### Priority
279279

280-
User agents must provide a mechanism of determining the relative priority of two
280+
User agents must provide a mechanism for determining the relative priority of two
281281
hash functions and return the empty string if the priority is equal. That is, if
282282
a user agent implemented a function like <dfn>getPrioritizedHashFunction(a,
283283
b)</dfn> it would return the hash function the user agent considers the most
@@ -329,12 +329,12 @@ resources accessed over a `file` scheme URL are unlikely to be
329329
eligible for integrity checks.
330330
{:.note}
331331

332-
One should note that being a [secure document][] (e.g. a document delivered
332+
One should note that being a [secure document][] (e.g., a document delivered
333333
over HTTPS) is not necessary for the use of integrity validation. Because
334334
resource integrity is only an application level security tool, and it does not
335335
change the security state of the user agent, a [secure document] is
336-
unnecessary. However, if integrity is used in other than a [secure document][] (e.g.
337-
a document delivered over HTTP), authors should be aware that the integrity
336+
unnecessary. However, if integrity is used in something other than a [secure document][]
337+
(e.g., a document delivered over HTTP), authors should be aware that the integrity
338338
provides <em>no security guarantees at all</em>. For this reason, authors should
339339
only deliver integrity metadata on a [potentially secure origin][]. See
340340
[Non-secure contexts remain non-secure][] for more discussion.
@@ -354,7 +354,7 @@ The following algorithm details these restrictions:
354354
<var>resource</var>'s origin, return `true`.
355355
4. Return `false`.
356356

357-
Step 3 returns `true` if the fetch was a CORS-enabled request. If the
357+
Step 2 returns `true` if the fetch was a CORS-enabled request. If the
358358
fetch failed the CORS checks, it won't be available to us for integrity
359359
checking because it won't have loaded successfully.
360360
{:.note}
@@ -600,7 +600,7 @@ integrity check <em>and</em> MUST return a network error, as described in
600600
[Modifications to Fetch][].
601601

602602
On a failed integrity check, an <code>error</code> event is thrown. Developers
603-
wishing to provide a canonical fallback resource (e.g. a resource not served
603+
wishing to provide a canonical fallback resource (e.g., a resource not served
604604
from a CDN, perhaps from a secondary, trusted, but slower source) can catch this
605605
<code>error</code> event and provide an appropriate handler to replace the
606606
failed resource with a different one.
@@ -679,8 +679,8 @@ with a value of [`no-transform`][notransform].
679679
<section>
680680
### Non-secure contexts remain non-secure
681681

682-
[Integrity metadata][] delivered to a context that is not a [secure context],
683-
such as an only protects an origin against a compromise of the
682+
[Integrity metadata][] delivered by a context that is not a [secure context],
683+
such as an HTTP page, only protects an origin against a compromise of the
684684
server where an external resources is hosted. Network attackers can alter the
685685
digest in-flight (or remove it entirely, or do absolutely anything else to the
686686
document), just as they could alter the response the hash is meant to validate.
@@ -722,7 +722,7 @@ logged into a particular service.
722722
Moreover, attackers can brute-force specific values in an otherwise
723723
static resource: consider a JSON response that looks like this:
724724

725-
{'status': 'authenticated', 'username': 'Stephan Falken'}
725+
{'status': 'authenticated', 'username': 'admin'}
726726
{:.example}
727727

728728
An attacker can precompute hashes for the response with a variety of
@@ -740,8 +740,9 @@ Much of the content here is inspired heavily by Gervase
740740
Markham's [Link Fingerprints][] concept, as well as WHATWG's [Link Hashes][].
741741

742742
A special thanks to Mike West of Google, Inc. for his invaluable contributions
743-
to the initial version of this spec. Additonally, Brad Hill, Anne van Kesteren, Mark Nottingham,
744-
Dan Veditz, Eduardo Vela, Tanvi Vyas, and Michal Zalewski provided invaluable feedback.
743+
to the initial version of this spec. Additonally, Brad Hill, Anne van Kesteren,
744+
Jonathan Kingston, Mark Nottingham, Dan Veditz, Eduardo Vela, Tanvi Vyas, and
745+
Michal Zalewski provided invaluable feedback.
745746

746747

747748
[Link Fingerprints]: http://www.gerv.net/security/link-fingerprints/

0 commit comments

Comments
 (0)