content-security-policy-builder
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

Content Security Policy builder

Build Status

Take an object and turn it into a Content Security Policy string.

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,
  },
});

This module is considered "complete". I expect to continue maintenance if needed, but I don't plan to add features or make breaking changes.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.1
    27,774
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.1.1
    27,774
  • 2.1.0
    438,058
  • 2.0.0
    23,112
  • 1.1.0
    7,241
  • 1.0.0
    9,643
  • 0.2.0
    522
  • 0.1.0
    1

Package Sidebar

Install

npm i content-security-policy-builder

Weekly Downloads

506,351

Version

2.1.1

License

MIT

Unpacked Size

5.02 kB

Total Files

6

Last publish

Collaborators

  • evanhahn