onedionys-content-security-policy-generator

5.0.0 • Public • Published

Welcome to One Dionys - Content Security Policy Generator! 👋

A utility for generating and deploying content security policies in web applications, improving application security. 💖

💾 Requirements

  • Web Browser - Can be used as an emulator to build applications. Example [Chrome, Firefox, Safari & Opera].
  • Internet - Because many use CDN and to make it easier to find solutions to all problems.

🎯 How To Use

Example Syntax

const generateCSP = require('content-security-policy-generator');

const options = {
    defaultSrc: ["'self'"],
    scriptSrc: ["'self'", 'example.com'],
    // Add more directives as needed
};

const cspHeader = generateCSP(options);
console.log(cspHeader);

Explanation

  • The generateCSP function takes an options object containing various directives for configuring the CSP. Each directive corresponds to a different aspect of web content security, such as allowed sources for scripts, styles, images, etc. The function then constructs a CSP header string based on these options and returns it.

Return Value

  • The function returns a string representing the Content Security Policy header that should be included in HTTP responses to instruct browsers on how to handle various types of content.

📆 Release Date

  • v1.0.0 : 17 March 2024
  • v1.0.1 : 18 March 2024
  • v5.0.0 : 31 March 2024

🧑 Author

📝 License

  • Copyright © 2024 One Dionys
  • One Dionys - Content Security Policy Generator is an open source project licensed under the MIT license

☕️ Suppport & Donation

Love One Dionys - Content Security Policy Generator? Support this project by donating or sharing with others in need.

Made with ❤️ One Dionys

Package Sidebar

Install

npm i onedionys-content-security-policy-generator

Weekly Downloads

10

Version

5.0.0

License

ISC

Unpacked Size

13.2 kB

Total Files

6

Last publish

Collaborators

  • onedionys