🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

content-security-policy-parser

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-security-policy-parser

Parse Content Security Policy directives.

0.6.0
latest
Source
npm
Version published
Weekly downloads
164K
13.41%
Maintainers
1
Weekly downloads
 
Created
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

security

FAQs

Package last updated on 10 Feb 2024

Did you know?

Socket

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