File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ def content_security_policy_nonce(type)
3434 end
3535 end
3636
37+ def content_security_policy_script_nonce
38+ content_security_policy_nonce ( :script )
39+ end
40+
41+ def content_security_policy_style_nonce
42+ content_security_policy_nonce ( :style )
43+ end
44+
3745 ##
3846 # Checks to see if the hashed code is expected and adds the hash source
3947 # value to the current CSP.
Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ def self.template
2727 background-color: black;
2828 }
2929<% end %>
30+
31+ <script nonce="<%= content_security_policy_script_nonce %>">
32+ alert(1)
33+ </script>
34+
35+ <style nonce="<%= content_security_policy_style_nonce %>">
36+ body {
37+ background-color: black;
38+ }
39+ </style>
3040<%= @name %>
3141
3242TEMPLATE
You can’t perform that action at this time.
0 commit comments