Commit 97ec04ac authored by Connor Shea's avatar Connor Shea

Add Subresource Integrity attribute to CSS and JS assets.

This prevents compromised or malicious CDNs from modifying assets. The hash provided by Rails is compared to the hash of the asset the browser has downloaded. The browser will refuse to execute/parse the assets if the hashes don't match. SRI is currently implemented in Firefox, Chrome, and Opera.

More information is available in #18230 and on MDN: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity

This doesn't apply to the dynamically-generated per-page JavaScript due to a bug in sprockets-rails (https://github.com/rails/sprockets-rails/issues/359).
parent cef02191
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
= favicon_link_tag 'favicon.ico' = favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application", media: "all" = stylesheet_link_tag "application", media: "all", integrity: true
= stylesheet_link_tag "print", media: "print" = stylesheet_link_tag "print", media: "print", integrity: true
= javascript_include_tag "application" = javascript_include_tag "application", integrity: true
- if page_specific_javascripts - if page_specific_javascripts
= javascript_include_tag page_specific_javascripts, {"data-turbolinks-track" => true} = javascript_include_tag page_specific_javascripts, {"data-turbolinks-track" => true}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment