Proactively protect your Node.js web services
Works on Node.js v6 and newer.
The purpose of this module is to provide out-of-box, proactive protection for common security problems, like SQL injection attacks, XSS attacks, brute force, etc...
This module is not a silver bullet, and is not a substitute for security-minded engineering work. But it can help you to achieve your goals.
npm i @risingstack/protect --save…protect.express.sqlInjection([options])Returns an Express middleware, which checks for SQL injections.
options.body: if this options is set (true), the middleware will check for request bodies as wellfalseoptions.loggerFunction: you can provide a logger function for the middleware to log attacksnoopprotect.express.xss([options])Returns an Express middleware, which checks for XSS attacks.
options.body: if this options is set (true), the middleware will check for request bodiesfalseoptions.loggerFunction: you can provide a logger function for the middleware to log attacksnoopprotect.express.rateLimiter([options])Returns an Express middleware, which ratelimits
options.id: function that returns the id used for ratelimiting - gets the request as its' first parameter(request) => request.connection.remoteAddressoptions.db: redis connection instanceoptions.max: max requests within options.durationoptions.max: of limit in millisecondsoptions.loggerFunction: you can provide a logger function for the middleware to log attacksnoopprotect.express.headers([options])The headers object is a reference to the main helmet object exported.
For docs on the options object, please refer to the helmet documentation.
As mentioned, this module isn't a silver bullet to solve your security issues completely. The following information is provided to hopefully point you in the right direction for solving other security concerns or alternatives that may be useful based on your budget or scale.
There are plenty of other areas that you should be concerned about when it comes to security, that this module doesn't cover (yet or won't) for various reasons. Here are a few that are worth researching:
If you have the resources available (budget or hosting environment), a dedicated WAF (Web Application Firewall) can offer a robust solution to various security issues, such as blocking potential attackers and flagging their activity.
No open issues yet, or sync has not completed.