Skip to content

Commit 065b30d

Browse files
author
Francois Marier
committed
Merge pull request #437 from metromoxie/sri-fail-on-no-cors
Fail closed on CORS failures
2 parents 4a66df1 + 0d73171 commit 065b30d

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

specs/subresourceintegrity/index.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ <h4 id="does-response-match-metadatalist">Does <var>response</var> match <var>me
541541
<a href="#parse-metadata">parsing <var>metadataList</var></a>.</li>
542542
<li>If <var>parsedMetadata</var> is <code>no metadata</code>, return <code>true</code>.</li>
543543
<li>If <a href="#is-response-eligible-for-integrity-validation"><var>response</var> is not eligible for integrity
544-
validation</a>, return <code>true</code>.</li>
544+
validation</a>, return <code>false</code>.</li>
545545
<li>Let <var>metadata</var> be the result of <a href="#get-the-strongest-metadata-from-set">getting the strongest
546546
metadata from <var>parsedMetadata</var></a>.</li>
547547
<li>For each <var>item</var> in <var>metadata</var>:
@@ -579,12 +579,10 @@ <h4 id="does-response-match-metadatalist">Does <var>response</var> match <var>me
579579
correctly, even if the HTTPS version of a resource differs from the HTTP
580580
version.</p>
581581

582-
<p class="note">This algorithm returns <code>true</code> if the response is not eligible for integrity
583-
validation, on the general principle that client errors (in this case, an
584-
attempt to validate the integrity of a response that is not accessible via
585-
same-origin or CORS) should fail open since they are not the result of an attack
586-
in the threat model of this specification. However, user agents SHOULD report
587-
a warning message about this failure in the developer console.</p>
582+
<p class="note">This algorithm returns <code>false</code> if the response is not <a href="#is-response-eligible-for-integrity-validation">eligible</a> for integrity
583+
validation since Subresource Integrity requires CORS, and it is a logical error
584+
to attempt to use it without CORS. Additionally, user agents SHOULD report a
585+
warning message to the developer console to explain this failure.</p>
588586
</section>
589587
<!-- Algorithms::Match -->
590588
</section>

specs/subresourceintegrity/spec.markdown

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ the user agent.
419419
[parsing <var>metadataList</var>][parse].
420420
2. If <var>parsedMetadata</var> is `no metadata`, return `true`.
421421
3. If [<var>response</var> is not eligible for integrity
422-
validation][eligible], return `true`.
422+
validation][eligible], return `false`.
423423
4. Let <var>metadata</var> be the result of [getting the strongest
424424
metadata from <var>parsedMetadata</var>][get-the-strongest].
425425
5. For each <var>item</var> in <var>metadata</var>:
@@ -455,12 +455,10 @@ correctly, even if the HTTPS version of a resource differs from the HTTP
455455
version.
456456
{:.note}
457457

458-
This algorithm returns `true` if the response is not eligible for integrity
459-
validation, on the general principle that client errors (in this case, an
460-
attempt to validate the integrity of a response that is not accessible via
461-
same-origin or CORS) should fail open since they are not the result of an attack
462-
in the threat model of this specification. However, user agents SHOULD report
463-
a warning message about this failure in the developer console.
458+
This algorithm returns `false` if the response is not [eligible] for integrity
459+
validation since Subresource Integrity requires CORS, and it is a logical error
460+
to attempt to use it without CORS. Additionally, user agents SHOULD report a
461+
warning message to the developer console to explain this failure.
464462
{:.note}
465463
</section><!-- Algorithms::Match -->
466464
</section><!-- Algorithms -->

0 commit comments

Comments
 (0)