Skip to main content

A library to generate CSP headers from HAR files

Project description

har2csp

har2csp is a command-line tool that generates Content Security Policy (CSP) headers from HTTP Archive (HAR) files. It analyzes the network requests in the HAR file and generates CSP directives that allow those requests, helping you to create a CSP for your website that doesn't break anything.

Installation

pip install har2csp

Usage

har2csp [-h] [-s SELF_URL] har_file_path

Positional Arguments

  • har_file_path: The path to the HAR file to generate CSP directives from.

Optional Arguments

  • -h, --help: Show a help message and exit.
  • -s SELF_URL, --self-url SELF_URL: The URL of the website that the HAR file was recorded from. Any requests to this URL will be ignored when generating the CSP directives.

Example

har2csp -s https://www.example.com example.har

This command will generate CSP directives from example.har, ignoring any requests to https://www.example.com. The directives will be printed to the console.

License

This project is licensed under the terms of the Apache 2.0 Licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

har2csp-1.0.0.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

har2csp-1.0.0-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page