1.3.4 • Published 8 months ago
umbress v1.3.4
Umbress is a fast and easy-to-use DDoS protection and mitigation Express.js middleware. It has several techniques of detection and mitigation like malicious IP addresses access mitigation (AbuseIPDB plugin or VirusTotal plugin), ratelimiter and others
Features
- Rate-limiter
- Malicious IP checker
Requirements
- Node.js >18
- Express >4
Install
$ npm install umbress --save
Usage
Starting from V2 umbress dropped pre-cooked machanisms and implemented extensive plugin system allowing users to re-use predefined plugins as well as create their own.
Example
import express from 'express';
const app = express();
app.use(
umbress<express.Request, express.Response>({
ipAddressExtractor: (request) => {
const xForwardedFor = request.headers['x-forwarded-for'];
if (Array.isArray(xForwardedFor)) {
return xForwardedFor.at(0) as string;
}
return xForwardedFor as string;
},
ipBasedMitigation: [
new AbuseIPDBPlugin({
accessToken: process.env.ABUSE_IPDB_ACCESS_TOKEN as string,
action: (request, response) => response.status(403).end(),
confidenceScoreToBan: 79,
maxAgeInDays: 30,
}),
new VirusTotalPlugin({
accessToken: process.env.VIRUS_TOTAL_ACCESS_TOKEN as string,
action: (request, response) => response.status(403).end(),
decisionMaker: (stats, vendorsData) {
return (
vendorsData.CrowdSec.result === VirusTotalResult.MALICIOUS || stats.malicious >= 10
);
},
}),
],
ratelimiter: new LeakyBucketRatelimiterPlugin({
capacity: 60,
rate: 1,
action: (request, response) => response.status(429).end(),
}),
}),
);
app.listen(3003);
License
Copyright 2020 JamesJGoodwin. Licensed MIT.
2.0.0-alpha.3
8 months ago
2.0.0-alpha.1
8 months ago
2.0.0-alpha.2
8 months ago
2.0.0
8 months ago
1.3.4
5 years ago
1.3.3
5 years ago
1.3.2
5 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.0
5 years ago
1.1.11
5 years ago
1.1.10
5 years ago
1.1.9
5 years ago
1.1.8
5 years ago
1.1.7
5 years ago
1.1.6
5 years ago
1.1.5
5 years ago
1.1.4
5 years ago
1.1.3
5 years ago
1.1.2
5 years ago
1.1.1
5 years ago
1.0.1
5 years ago
1.0.0-rc
5 years ago
1.0.0
5 years ago