Open
Description
To improve the security of using third-party scripts, we're able to compute the integrity of a script at build time and inject it within the <script>
tag.
For example, we can do something like this:
useScript({ src: 'https://example.com/test.js' })
-->
// without bundling
useScript({ src: 'https://example.com/test.js', integrity: 'sha512-...' })
// with bundling
useScript({ src: '/....js', integrity: 'sha512-...' })
This would provide a window between builds that would block potential attackers from modifying the script with malicious code. If a script source has already been attacked when the integrity is computed it wouldn't do anything useful.
@vejja Would be great to have your input on this 🙏