1.3.9 • Published 1 month ago

mitigation v1.3.9

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

Mitigation

A somewhat advanced layer 7 IP filtering mechanism designed to block bad actors

1.3.5 - Change Log | Updated Actor Detection

Security Options

The securityOptions object allows you to customize the protection mechanisms according to your requirements. Here are the available security options

blockBadHostname : Blocks requests with a suspicious or malformed hostname.

blockRequestFromServers : Blocks requests coming from known server IPs.

blockRequestFromVPN : Blocks requests coming from VPNs.

blockRequestFromWebProxy : Blocks requests coming from web proxies.

blockRequestFromTOR : Blocks requests coming from the TOR network.

blockPublicProxy : Blocks requests coming from public proxy servers.

blockSearchEngineRobot : Blocks requests coming from search engine robots.

blockHostname : Blocks requests with a specific hostname.

blockNoProxyIssues : Blocks requests if no proxy-related issues are detected.

blockNoProxyIssues : Blocks requests if no proxy-related issues are detected.

whitelist : (set) Whitelist given ip's bypassing actor detection.

logging : Enables live logs of ip addresses actively being blocked.

throttling : Enables only a certain amount of concurrent requests to access your site

throttleAmount : If throttling is enabled, you can set the allowed concurrent requests here.

Usage

Here's how you can use the mitigation middleware in your Express.js application:

const express = require('express');
const mitigation = require('mitigation');

const app = express();
const port = 3000;

const securityOptions = {
  blockRequestFromServers: true,
  blockRequestFromVPN: true,
  blockRequestFromWebProxy: true,
  blockRequestFromTOR: true,
  blockPublicProxy: true,
  blockSearchEngineRobot: true,
  blockHostname: true,
  blockNoProxyIssues: true,
  whitelist: new Set(['192.168.1.1', '10.0.0.1']), // Example whitelist IP addresses
  throttling: true, // Enable throttling
  throttleAmount: 100, // Specify the throttle amount
  logging: true //Enables Logging
};

app.use(mitigation(securityOptions));

app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.listen(port, () => {
  console.log(`Express server is listening on port ${port}`);
});
1.3.9

1 month ago

1.3.7

1 month ago

1.3.6

1 month ago

1.3.5

1 month ago

1.3.8

1 month ago

1.3.4

1 month ago

1.3.3

2 months ago

1.3.2

2 months ago

1.3.1

2 months ago

1.3.0

2 months ago

1.2.8

2 months ago

1.2.7

2 months ago

1.2.6

2 months ago

1.2.5

2 months ago

1.2.4

2 months ago

1.2.3

2 months ago

1.2.2

2 months ago

1.2.0

2 months ago

1.2.1

2 months ago

1.1.9

2 months ago

1.1.8

2 months ago

1.1.7

2 months ago

1.1.6

2 months ago

1.1.5

2 months ago

1.1.4

2 months ago

1.1.3

2 months ago

1.1.2

2 months ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago