Subresource Integrity

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Iiii I I I (talk | contribs) at 18:17, 3 May 2018 (update support). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Subresource Integrity or SRI is a W3C recommendation to provide a method to protect website delivery. Specifically, it validates assets served by a third party, such as a content delivery network (CDN). This ensures these assets have not been compromised for hostile purposes.

To use SRI, a website author wishing to include a resource from a third party can specify a cryptographic hash of the resource in addition to the location of the resource. Browsers fetching the resource can then compare the hash provided by the website author with the hash computed from the resource. If the hashes don't match, the resource is discarded.[1]

As of May 2018, SRI is supported by Microsoft Edge, Firefox, Safari, Google Chrome, and Opera.[2]

Sample link element with integrity attribute used by SRI:

<link rel="stylesheet" href="https://cdn.example.com/style.css"
     integrity="sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB">

References

  1. ^ "Subresource Integrity". Mozilla Developer Network. Retrieved 14 April 2016.
  2. ^ "Subresource Integrity". Can I use... Support tables for HTML5, CSS3, etc. Retrieved 3 May 2018.

External links