tasvideos
tasvideos copied to clipboard
Use Subresource Integrity on all `<script/>`s and `<link/>`s
Are there third-party resources where we don't currently use the integrity attribute?
No, or at least not on the landing page.
Array.from(document.querySelectorAll("script, link"))
.filter(e => !e.hasAttribute("integrity"))
.map(e => e.src || e.href)
.filter(s => !s.startsWith("https://tasvideos.org"))
// => Array []
We decided to not put integrity hashes on script tags.
- We converted to no inline script usage, and put a CSP to disable them. All script tags now reference a .js file
- We can trust that the referenced file on our server is what we think it is. Or inversely, if someone can take control of the .js files on our server, they can easily take control of the html as well, so this restriction does not add any additional security
It will makes sense to have integrity checks on all 3rd party referenced .js files as we do not control what happens to their server