0.6.0 • Published 3 months ago

content-security-policy-parser v0.6.0

Weekly downloads
6,548
License
MIT
Repository
github
Last release
3 months ago

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.