Socket
Socket
Sign inDemoInstall

@techytools/constants

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @techytools/constants


Version published
Weekly downloads
9
increased by12.5%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Content Security Policy (CSP)

Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft, to site defacement, to malware distribution.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP

Implementation

"To improve the security of your application, you can use headers in next.config.js to apply HTTP response headers to all routes in your application."

https://nextjs.org/docs/advanced-features/security-headers

Usage

In next.config.js add a headers:

...config,
async headers() {
    return [
      {
        headers: [
          {
            key: 'Content-Security-Policy',
            value: ContentSecurityPolicy.replace(/\s{2,}/g, ' ').trim(),
          },
        ],
        source: '/:path*',
      },
    ];
  },

FAQs

Last updated on 24 Aug 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc