Socket
Socket
Sign inDemoInstall

content-security-policy-builder

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    content-security-policy-builder

Build Content Security Policy directives.


Version published
Weekly downloads
501K
decreased by-1.88%
Maintainers
1
Install size
5.88 kB
Created
Weekly downloads
 

Changelog

Source

2.1.1 - 2022-03-23

Changed

  • Fixed bug where names on Object.prototype didn't work
  • Marked inputs as Readonly (TypeScript-only)
  • Shrink package size a bit

Readme

Source

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.

Keywords

FAQs

Last updated on 23 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc