auto-smart-security 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ class BotDetector {
6
6
  constructor(limit = 8) {
7
7
  this.limit = limit;
8
8
  this.scores = new Map();
9
- this.ttl = 60000; // 1 phút
9
+ this.ttl = 60000; // 1 minute
10
10
  }
11
11
  detect(req) {
12
12
  if (req.method === 'OPTIONS')
@@ -16,17 +16,17 @@ class BotDetector {
16
16
  if (!ua || ua.length < 20)
17
17
  score += 2;
18
18
  if (/(curl|wget|python|java|scrapy|axios|httpclient|go-http)/.test(ua))
19
- score += 5;
19
+ score += 10;
20
+ if (/(wp-admin|\.env|phpmyadmin|cgi-bin)/i.test(req.originalUrl)) {
21
+ score += 100;
22
+ }
20
23
  if (!req.headers?.accept)
21
24
  score += 1;
22
25
  if (!req.headers?.['accept-language'])
23
26
  score += 1;
24
27
  if (!req.headers?.['sec-fetch-site'])
25
28
  score += 2;
26
- if (!req.headers?.cookie)
27
- score += 1;
28
- if (/(wp-admin|\.env|phpmyadmin|cgi-bin)/i.test(req.originalUrl))
29
- score += 5;
29
+ // if (!req.headers?.cookie) score += 1;
30
30
  const ip = (0, utils_1.getClientIP)(req);
31
31
  const now = Date.now();
32
32
  const entry = this.scores.get(ip);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-smart-security",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Production-ready security middleware for Express / NestJS",
5
5
  "author": "Hai Vinh <haivinhinspirit@gmail.com>",
6
6
  "main": "dist/index.js",