npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mdworld/ingress-headers

v1.0.5

Published

A TypeScript utility for extracting and managing Content Security Policy (CSP) headers from Kubernetes ingress YAML files

Downloads

5

Readme

GitHub Actions Workflow Status NPM Version

ingress-headers

A TypeScript utility for extracting and managing Content Security Policy (CSP) headers from Kubernetes ingress YAML files.

Purpose

This package provides tools to:

  • Read CSP policies from ingress YAML configurations and convert them to structured JSON format
  • Write CSP policies in ingress YAML files using JSON input

Use Cases

  • Environment Migration: Easily copy CSP policies from one environment to another
  • Policy Analysis: Convert complex CSP strings into readable JSON format for analysis
  • Bulk Updates: Programmatically update CSP policies across multiple ingress configurations
  • CSP Debugging: Break down CSP directives into organized, sortable JSON structures

Installation

npm i -g @mdworld/ingress-headers

Usage

As a Library

import { readCSP, writeCSP, CSPDirectives } from "ingress-headers";

// Read CSP from YAML file
const cspData: CSPDirectives = readCSP("path/to/ingress.yaml");

// Write CSP to YAML file
await writeCSP("path/to/target.yaml", cspData);

Command Line Tools

After installation, you can use the unified CLI tool:

# Extracts CSP from a YAML file and outputs it as JSON to stdout
ingress-headers read example/ingress.yaml > headers.json

# Updates CSP in a YAML file using JSON input from stdin
ingress-headers write example/ingress.yaml < headers.json

# Pipe from read to write, this will just copy the CSP header to another YAML
ingress-headers read source.yaml | ingress-headers write target.yaml

Development Mode

Installation:

npm install
npm run build
# Unified command (recommended)
npx ts-node src/ingress-headers.ts read example/ingress.yaml
npx ts-node src/ingress-headers.ts write target.yaml < headers.json
npx ts-node src/ingress-headers.ts read source.yaml | npx ts-node src/ingress-headers.ts write target.yaml

# Individual commands (for development)
npx ts-node src/read_headers.ts example/ingress.yaml
npx ts-node src/read_headers.ts source.yaml | npx ts-node src/write_headers.ts target.yaml