Express middleware that detects SQL injection attempts in query strings, route parameters, and request bodies, responding with a 403 status code. Currently at version 0.0.7 (last updated in 2016). No recent updates; relies on simple regex patterns, which may have bypass vectors. Not recommended for production. No TypeScript types, ESM, or CJS dual support. Last commit 2017.
npm install sql-injectionNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to integrate the middleware into an Express app to block SQL injection attempts.
Consider alternatives like express-mongo-sanitize or parameterized queries.
Always use parameterized queries (e.g., prepared statements) as primary defense.
Review and update regex patterns or use a more sophisticated solution.
Run 'npm install sql-injection' in the project root.
Use `app.use(sqlinjection)` without calling it as a function.