benji.monster/node_modules/content-security-policy-builder
2020-01-03 21:48:09 +01:00
..
dist upload site 2020-01-03 21:48:09 +01:00
CHANGELOG.md upload site 2020-01-03 21:48:09 +01:00
LICENSE upload site 2020-01-03 21:48:09 +01:00
package.json upload site 2020-01-03 21:48:09 +01:00
README.md upload site 2020-01-03 21:48:09 +01:00

Content Security Policy builder

Build Status

Take an object and turn it into a Content Security Policy string. Useful for building Content Security Policy libraries.

It can handle a lot of things you can you throw at it; camelCased or dash-separated directives, arrays or strings, et cetera.

Usage:

const builder = require('content-security-policy-builder')

// default-src 'self' default.com; script-src scripts.com; whatever-src something; object-src
builder({
  directives: {
    defaultSrc: ["'self'", 'default.com'],
    scriptSrc: 'scripts.com',
    'whatever-src': 'something',
    objectSrc: true
  }
})