nuxt-security

🛡️ Security Module for Nuxt based on HTTP Headers and Middleware
6,184,506 979
Install
npm install nuxt-security
Latest Version:2.6.0
Vue:3
License:MIT
Last Updated:Aug 9, 2026
Links: GitHub  ·  npm
Maintainer: baroshem

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.X and newer (4.X)

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:

npx nuxi@latest module add 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

Related Packages

@xarenas107/nuxt-uncsrf

Nuxt module for csrf protection

855 0
nuxt-api-shield

Nuxt API Shield - Rate Limiting

71,335 55
@radya/nuxt-dompurify

A Nuxt 3 module that integrates DOMPurify for sanitizing HTML content and protec...

28,438 8
purrrify

A Nuxt module that integrates sanitize-html for sanitizing HTML content and prot...

2,066 4
nuxt-csp-report

A Nuxt module for collecting, normalizing, and persisting Content Security Polic...

16,874 18

Version History

Version Released License
2.6.0 MIT
2.5.1 MIT
2.5.0 MIT
2.4.0 MIT
2.3.0 MIT
Pre-releases (20)
Version Released License
2.0.0-rc.9 MIT
2.0.0-rc.8 MIT
2.0.0-rc.7 MIT
2.0.0-rc.6 MIT
2.0.0-rc.5 MIT