Use SHA256 for JavaScript subresource integrity#10647
Merged
Conversation
changelog: Internal, Build Tooling, Use SHA256 for JavaScript subresource integrity
mitchellhenke
approved these changes
May 17, 2024
Contributor
Author
For posterity, an integrity hash was added for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠 Summary of changes
Updates subresource integrity hashes produced by the Webpack configuration to use SHA256 instead of SHA512.
This is a continuation of improvements around resource hints started in #10612, where Rails' hard cap of 1kb resource hints also includes integrity hashes, which you can see in production today for all preloaded JavaScript (except
init.js):The intent of these changes is to use a hash with a smaller byte size, without meaningfully sacrificing security. By using smaller hashes, the hope is that more assets can fit within the 1kb resource hint limit.
Additional considerations:
<script>tag (integrityattributes currently account for ~6% of the markup size on https://secure.login.gov )📜 Testing Plan
NODE_ENV=production yarn buildrails s<script>tags at the bottom of<body>includeintegrity=sha256-attributes