perfect-express-sanitizer is an Express.js middleware and utility library for sanitizing user input against Cross-Site Scripting (XSS), SQL injection, and NoSQL injection attacks. Version 2.0.2, released periodically, provides middleware to clean request body, query, and headers. It supports custom forbidden keywords and regular expressions, customizable cleanup levels, and can be used standalone for string sanitation. Unlike express-validator or helmet, this package focuses specifically on input sanitization with aggressive removal of malicious patterns, though it has limited documentation and may produce false positives.
npm install perfect-express-sanitizerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up Express middleware to automatically sanitize request body, query, and headers.
Update to v2 and use sanitizer.clean({...}) or sanitizer.sanitize.prepareSanitize().Check changelog for option removals; use 'level' to control aggressiveness.
Set level: 2-3 and add exceptions via customizeFile or forbiddenTags.
Create a .d.ts file or use @ts-ignore.
Use sanitizer.sanitize.prepareSanitize() on individual strings instead of middleware.
Ensure version >=1.0.0 and use const sanitizer = require('perfect-express-sanitizer'); then sanitizer.clean({...}).Run 'npm install perfect-express-sanitizer' and verify package.json.
Add const sanitizer = require('perfect-express-sanitizer'); at the top of your file.No dependency data recorded yet.