nuxt-security
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

nuxt-security

npm version npm downloads Github Actions CI License Nuxt

Nuxt Security

Automatically configure your app to follow OWASP security patterns and principles by using HTTP Headers and Middleware.

This module works with Nuxt 3 only

Features

  • Security response headers (including CSP for SSG apps)
  • Request Size & Rate Limiters
  • Cross Site Scripting (XSS) Validation
  • Cross-Origin Resource Sharing (CORS) support
  • Hide X-Powered-By header and remove console loggers utils
  • [Optional] Allowed HTTP Methods, Basic Auth, CSRF

Usage

Install the module:

npm i -D nuxt-security
yarn add -D nuxt-security
pnpm add -D nuxt-security

Add the module in the modules array in nuxt.config.ts:

export default defineNuxtConfig({
  modules: ["nuxt-security"],
})

And that's it! The module will now register route rules and server middlewares globally so that your application will be more secured.

Configuration

You can pass configuration to the module in the nuxt.config.ts like following:

export default defineNuxtConfig({
  modules: ["nuxt-security"],
  security: {
    // options
  }
})

For all available configuration options check out the docs.

Development

  • Run yarn dev:prepare to generate type stubs.
  • Use yarn dev to start playground in development mode.

License

MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.2
    9,471
    • latest

Version History

Package Sidebar

Install

npm i nuxt-security

Weekly Downloads

22,161

Version

1.2.2

License

MIT

Unpacked Size

78.4 kB

Total Files

52

Last publish

Collaborators

  • baroshem