GithubHelp home page GithubHelp logo

hssanbzlm / nuxt-security Goto Github PK

View Code? Open in Web Editor NEW

This project forked from baroshem/nuxt-security

0.0 0.0 0.0 2.28 MB

🛡 Security Module for Nuxt based on OWASP Top 10 and Helmet

Home Page: https://nuxt-security.vercel.app/

License: MIT License

TypeScript 99.41% Vue 0.59%

nuxt-security's Introduction

nuxt-security

nuxt-security

npm version npm downloads Github Actions CI Codecov License

OWASP Top 10 module that adds a few security improvements in form of a customizable server middlewares to your Nuxt application. All middlewares can be modified or disabled if needed. They can also be configured to work only on certain routes. By default all middlewares are configured to work globally.

Features

  • Nuxt 3 ready
  • Same Security headers set as by popular Express.js middleware helmet
  • Hidden 'X-Powered-By' header
  • Request Size Limiter
  • Rate Limiter
  • XSS Validator for both GET and POST requests
  • CORS Handler similar to popular Express.js middleware
  • Allowed HTTP Methods Restricter
  • Basic Auth support
  • TypeScript support

📖  Read the documentation

Preview

Open in StackBlitz

Setup

yarn add nuxt-security # yarn
npm i nuxt-security # npm

Usage

The only thing you need to do to use the module in the default configuration is to register the module in the modules array in nuxt.config.ts:

// nuxt.config.js

{
  modules: [
    "nuxt-security",
  ],
  security: {} // optional
}

The module will configure for you several response headers with the values recommended by Helmet as well as custom middlewares for rate and request limiting, xss validation, and CORS handling. More to come soon!

If you wish to modify them you can do so from the configuration:

// nuxt.config.js

{
  modules: [
    "nuxt-security",
  ],
  security: {
    requestSizeLimiter: {
      value: {
        maxRequestSizeInBytes: 3000000,
        maxUploadFileRequestInBytes: 9000000,
      },
      route: '/upload-file'
    }
  }
}

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

nuxt-security's People

Contributors

baroshem avatar damianglowala avatar 0xflotus avatar intevel avatar danielroe avatar pi0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.