Socket
Socket
Sign inDemoInstall

content-security-policy-parser

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-parser

Parse Content Security Policy directives.


Version published
Weekly downloads
69K
increased by28.39%
Maintainers
1
Install size
11.1 kB
Created
Weekly downloads
 

Changelog

Source

0.6.0 - 2024-02-10

Changed

  • Breaking: Parse into a Map instead of an object
  • Breaking: Follow the CSP parser spec more closely. See #12

Readme

Source

Content Security Policy parser

Take a Content Security Policy string and parse it via the spec.

Usage:

import parseContentSecurityPolicy from "content-security-policy-parser";

parseContentSecurityPolicy(
  "default-src 'self'; script-src 'unsafe-eval' scripts.example; object-src; style-src styles.example",
);
// => Map(4) {
//      "default-src" => ["'self'"],
//      "script-src" => ["'unsafe-eval'", "scripts.example"],
//      "object-src" => [],
//      "style-src" => ["styles.example"],
//    }

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 10 Feb 2024

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