bridgetown.automation.rb in bridgetown-content-security-policy-0.1.1 vs bridgetown.automation.rb in bridgetown-content-security-policy-1.0.0
- old
+ new
@@ -2,21 +2,24 @@
add_bridgetown_plugin "bridgetown-content-security-policy"
create_file "content_security_policy.config.rb" do
<<~RUBY
- # The recommended default Content Security Policy
+ # The recommended default Content Security Policy
BridgetownContentSecurityPolicy.configure :default do |policy|
policy.default_src :self
policy.img_src :self, :data
policy.object_src :none
+
+ # Allow BrowserSync in development
+ policy.script_src :self, :unsafe_inline if Bridgetown.environment.development?
end
# All other policies with inherit from :default
# To allow inline styles on certain pages, we can define the following
# policy which inherits all the values from :default and defines a style_src
- #
+ #
# BridgetownContentSecurityPolicy.configure :allow_inline_styles do |policy|
# policy.style_src :self, :unsafe_inline
# end
\ No newline at end of file