Git Product home page Git Product logo

bridgetown-content-security-policy's Introduction

Bridgetown Content Security Policy

Tests Gem Version

A Bridgetown plugin to include a Content Security Policy as a meta tag on all your pages.

Installation

Run this command to install this plugin:

$ bundle exec bridgetown apply https://github.com/ayushn21/bridgetown-content-security-policy

Usage

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.

Including the CSP on your web pages

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.

  • Liquid templates: {% content_security_policy %}
  • ERB: <%= content_security_policy %>

Add the appropriate CSP tag in the head tag of your layout file to include the CSP on all your pages.

Testing

  • Run bundle exec rake test to run the test suite
  • Or run script/cibuild to validate with Rubocop and run tests together.

Contributing

  1. Fork it (https://github.com/ayushn21/bridgetown-content-security-policy/fork)
  2. Clone the fork using git clone to your local development machine.
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

License

Bridgetown Content Security Policy is released under the MIT License.

Copyright © 2021 Ayush Newatia

bridgetown-content-security-policy's People

Contributors

ayushn21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bridgetown-content-security-policy's Issues

Helper for ERB/etc.?

Just throwing a request out there to provide an equivalent helper for Ruby-based templates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.