A Bridgetown plugin to add a Content Security Policy in a meta tag
MIT License
A Bridgetown plugin to include a Content Security Policy as a meta tag on all your pages.
Run this command to install this plugin:
$ bundle exec bridgetown apply https://github.com/ayushn21/bridgetown-content-security-policy
The plugin allows you to define one or more Content Security Policies using a convenient Ruby DSL.
The installation should create a content_security_policy.config.rb
file in your project's config
directory. More info about the DSL is contained in the file.
You can define a specific CSP for pages by setting content_security_policy:
in your frontmatter; and then defining the relevent CSP in content_security_policy.config.rb
.
All page specific CSPs will inherit from the default
CSP.
You'll need to add a content_security_policy
tag to your layout file(s) to include the CSP meta tag in all your pages. This plugin supports Liquid, ERB and other Tilt based templating languages like HAML or Slim.
{% content_security_policy %}
<%= content_security_policy %>
Add the appropriate CSP tag in the head
tag of your layout file to include the CSP on all your pages.
bundle exec rake test
to run the test suitescript/cibuild
to validate with Rubocop and run tests together.git clone
to your local development machine.git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Bridgetown Content Security Policy is released under the MIT License.
Copyright © 2021 Ayush Newatia