-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
The first public working draft of the SRI specifications has just been released. It defines a hash checksum of linked resources to prevent bad actors from being able to inject arbitrary code from a compromised external server or CDN resource.
Example:
<link rel="stylesheet" href="https://site53.example.net/style.css"
integrity="sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB"
crossorigin="anonymous">
It would be cool if importmap can add support for the checksum hash. It would make sense to create or get the checksum when pinning the library.
Perhaps importmap.rb can add the checksum field:
pin "exampleLibrary", to: "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/library.min.js", checksum: "sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB"
The generated code could look like the following:
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/library.min.js" integrity="sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB">
I believe the adoption of SRI can make external resources more trustworthy and close a security hole in the event that an external resource is compromised by bad actors.
Metadata
Metadata
Assignees
Labels
No labels