express-route-sanitizer-middleware
v1.0.4
Published
A sanitizer for GET and POST requests payloads
Downloads
5
Maintainers
Readme
Express Route Sanitizer Middleware
This middleware will enable sanitizing requests on a route-scope, with minimum addition of code.
The main goal is to eliminate attemps to exploit XSS flaws on our express web server in order to keep sensitive back-end services working as usual.
The package uses minimal dependencies in order to simulate the browser's DOM and sanitize all requested data. Packages: DOMPurify, JSDom, Canvas.
Installation
npm i express-route-sanitizer-middleware
import into your Express app main file.
use as a middle-ware on a specific route/controller
Example
const app = express();
import sanitizer from "express-route-sanitizer-middleware";
// Requests to this route will first go through the sanitizer
app.use('/users', sanitizer, require('./controllers/users-api'));
app.listen(port);