-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Accept additional attributes for assets to support SRI #436
Conversation
…ipt/link tags/elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good but I don't get why we need to validate asset attributes.
packages/webpack-plugin/src/index.js
Outdated
@@ -26,6 +33,24 @@ class LoadablePlugin { | |||
errorDetails: false, | |||
timings: false, | |||
}) | |||
|
|||
// include extra asset keys if present | |||
stats.assets = stats.assets.map((asset) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will be fine without that isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you're absolute right! I was forcing loadable-stats.json
to store integrity
when it didn't need to be there.
assetToScriptTag(asset, extraProps), | ||
assetToScriptTag({ | ||
...asset, | ||
...this.getSriFromFileName(asset.filename), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these is useless, the integrity should already be in asset. The only needed part is : getSriHtmlAttributes and all usage of it.
Summary
Potential fix for feature request in issue #344 which will add SRI integrity to be html tags before sending to client, if the value exists on the asset.
Test plan
Webpack
In the server renderer script
Also worth adding the
crossorigin
key (this functionality already existed and isn't being introduced by this PR)Start application
Confirm that during SSR run the tags have
integrity
key with correct value