Parcel: Subresource Integrity

Created on 11 Sep 2018  路  9Comments  路  Source: parcel-bundler/parcel

Feature Request

Hi! Does Parcel support Subresource Integrity?

馃敠 Context

I'm still testing and reading about Parcel (yes, I started last weekend) and couldn't find anything about it.

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |
| Node |
| npm/Yarn |
| Operating System |

Feature

Most helpful comment

I've written a package to handle SRI for parcel: https://www.npmjs.com/package/parcel-plugin-subresource-integrity

Give it a try and feel free to ping me with an issue if you get stuck.

All 9 comments

It currently does not

Sent with GitHawk

Thank you, @DeMoorJasper . 馃槥

Hey @DeMoorJasper, I would like to work on this issue, if you don't mind I would like you to guide me a little bit!

@Taym95 awesome, the html transforms are being done inside assets/HTMLAsset https://github.com/parcel-bundler/parcel/blob/master/src/assets/HTMLAsset.js

You might wanna look at how the name replacing got implemented, as this would need the hash of the final bundles. (and HTMLAsset only has access to asset hashes of the JS files) Not even sure this is possible, didn't realise it when I originally flagged this as good first issue

Oops!

Not even sure this is possible

HTMLPackager would have to run after all childBundles are completely packaged. That isn't the case.
First attempt here: https://github.com/parcel-bundler/parcel/tree/subres-integrity

Mhm, I got the feeling SRI only makes sense when using CORS or external dependencies (like CDNs). What would be the benefits in checksuming the files in the same domain?

I've written a package to handle SRI for parcel: https://www.npmjs.com/package/parcel-plugin-subresource-integrity

Give it a try and feel free to ping me with an issue if you get stuck.

cool. it would really be nice if Parcel did it natively.

Was this page helpful?
0 / 5 - 0 ratings