-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support subresource integrity #174
Comments
Heya, this is out of scope for this repository. See discussion at https://github.com/WICG/import-maps#supplying-out-of-band-metadata-for-each-module and the previous similar iissue, #99. I'll close this since we won't be working on it in this repository, but I'm happy to continue discussing in the close thread. |
+1 to the idea of using import maps for subresource integrity as |
The slides at https://docs.google.com/presentation/d/1qfoLTniLUVJ5YNFrha7BaVumAnW0ZgcCfUU8UbyyuYY/edit#slide=id.g1f527b5ce9_0_108 (starting at slide 13) were helpful toward explaining the down-side of modifying the I may still be inadequately informed in my comments here, but have a few thoughts... Isn't And though there is the difficulty of manually managing integrity meta-data inline, tooling could no doubt help with this, e.g., to get checksums from the likes of local npm copies and expect the same on the CDN, and then rebuilding all of the local ones. In addition, the out-of-band solution introduces its own additional can-of-worms in that it would break modularity, requiring storage of meta-data on a resource in a manner unconnected directly with that resource. That all being said, unlike the other meta-data attributes (e.g., cross-origin, etc.) which have an impact on how the application works, integrity might be a special case in that it is just pass-or-fail and the preparer may wish to do their own separate calculation/verification of the hashes anyways--e.g., they could, like custom resolutions in yarn, let one avoid being locked in to a vulnerable dependency. (npm, for a perhaps useful comparison, does its own out-of-band tracking of checksums--not expecting packages to manage this themselves.) And by the meta-data being stored out-of-band, diff noise would be avoided (though admittedly source files might not be including this meta-data themselves even if dist files were to store the data in-band.) So maybe the solution is for |
@domenic, do you know of any current discussion on this? It's been a couple years, and it seems like there's still no way to do this. Here's my situation:
It seems like there's currently no way to do this? Is there anywhere you know of where discussion is happening on this? If not, do you know of somewhere that it would be productive to restart this discussion? |
I should note for other wanderers that I guess a "solution" might be to write a wrapper around |
@WesleyAC thanks for poking at this, that's a great summary. Moving forward it seems we have three options:
I would also really appreciate knowing which way to go here - I'm personally happy to work on specifying any standards work here, it just depends on where the implementation direction lands. |
fwiw, I'm personally a fan of There is perhaps room for a fourth option using import assertions, but that seems out of scope for import maps: import { camelCase } from 'https://unpkg.com/lodash' assert {
integrity: "sha384-...",
crossorigin: "anonymous",
}; |
Note that the most recent discussion are in #221; in particular see my thoughts in #221 (comment). |
It would be incredibly useful for import maps to support subresource integrity hashes that are checked against similar to
<script integrity=""/>
. This is extra important because one of the primary goals of import mapping is to support delivery from 3rd party CDNs (such as unpkg) -- for security, SRI is almost vital when using an external CDN.This might come in the form:
Note the new option of a
{ url, integrity }
object in place of a string URL on its own.Alternatively, a top-level
integrity
object mapping URL to SRI hash might be a better fit as it is backwards-compatible with existing browser and polyfill implementations, and supports adding SRI for nested imports likecool-module/file.js
.The text was updated successfully, but these errors were encountered: