JSPM

sql-sanitizer

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 42
  • Score
    100M100P100Q68163F
  • License MIT

Here this express module detects SQL injection attacks and rejects the requests.

Package Exports

  • sql-sanitizer
  • sql-sanitizer/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sql-sanitizer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status Code Size

sql-sanitizer

Here the express module detects SQL injection attacks and stops them by sending 403 as a response. The module checks the query string, route parameters, and body for any SQL injection-related contents.

let app = express();
let sqlSanitizer = require('sql-sanitizer');
app.use(sqlSanitizer);

Installation

$ npm install sql-sanitizer

Usage

Example:

let express = require('express');
let app = express();
let sqlSanitizer = require('sql-sanitizer');
app.use(sqlSanitizer);

app.post('/route1', (req, res) => {
    res.status(200).send({});
});
app.get('/route2/:uid', (req, res) => {
    res.status(200).send({});
});
app.post('/route3', (req, res) => {
   res.status(200).send({});
});

app.listen(4000);