Skip to content

Commit 09e8bc6

Browse files
committed
Merge pull request #492 from fmarier/issue487
SRI: Add response tainting to the eligibility algorithm (fixes #487)
2 parents 4d4507b + 86c5572 commit 09e8bc6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

specs/subresourceintegrity/spec.markdown

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,27 @@ The following algorithm details these restrictions:
350350

351351
1. Let <var>request</var> be the request that fetched
352352
<var>resource</var>.
353-
2. If the [mode][fetch-mode] of <var>request</var> is `CORS`,
353+
2. If the [response type][] is `opaque`, return `false`.
354+
3. If the [mode][fetch-mode] of <var>request</var> is `CORS`,
354355
return `true`.
355-
3. If the [origin][fetch-origin] of <var>request</var> is
356+
4. If the [origin][fetch-origin] of <var>request</var> is
356357
<var>resource</var>'s origin, return `true`.
357-
4. Return `false`.
358+
5. Return `false`.
358359

359-
Step 2 returns `true` if the fetch was a CORS-enabled request. If the
360+
Step 3 returns `true` if the fetch was a CORS-enabled request. If the
360361
fetch failed the CORS checks, it won't be available to us for integrity
361362
checking because it won't have loaded successfully.
362363
{:.note}
363364

365+
Since the [response type][] for data URLs will always be "opaque" for
366+
`script` and `link` elements, such URLs are never eligible for integrity
367+
checks. Blob URLs on the other hand are usually considered same-origin and
368+
therefore are eligible for integrity checks.
369+
{:.note}
370+
364371
[fetch-mode]: https://fetch.spec.whatwg.org/#concept-request-mode
365372
[fetch-origin]: https://fetch.spec.whatwg.org/#concept-request-origin
373+
[response type]: https://fetch.spec.whatwg.org/#concept-response-type
366374
</section><!-- Algorithms::eligible -->
367375
<section>
368376
#### Parse <var>metadata</var>.

0 commit comments

Comments
 (0)