1.0.4 • Published 9 months ago

xss-req-sanitizer v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

xss-req-sanitizer

Build Status Coverage Status

xss-req-sanitizer is a middleware to sanitize http requests to prevent XSS attacks.

Installation

npm install xss-req-sanitizer

How to use ?

var express = require('express')
var bodyParser = require('body-parser')
var xssReqSanitizer = require('xss-req-sanitizer')

var app = express()

app.use(bodyParser.json())

// this should comes before any routes
app.use(xssReqSanitizer())

app.post('/your-route', (req, res) => {

   // All the values from,
   // req.body, req.params, req.query 
   // will be sanitized in-place.

})

Testing & Contributing

npm install
npm test

License

MIT