@abtnode/router-provider 1.16.38-beta-20250118-033334-2da05ae8 → 1.16.38-beta-20250120-112111-55c032e8

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.
package/README.md CHANGED
@@ -54,7 +54,13 @@ There are various ways for you to contribute to this package, such as adding sup
54
54
  - [ ] Openresty
55
55
  - [ ] Tengine
56
56
  - [ ] AWS ELB
57
- - [ ] Node.js
57
+ - [x] Node.js
58
58
  - [x] Nginx: supported
59
59
 
60
60
  If you are working with the nginx routing engine, you may found this tool useful: <https://nginx.viraptor.info/>
61
+
62
+ ## How to update the CRS rules
63
+
64
+ 1. Pull the latest rules from the CRS repository
65
+ 2. Copy the rules in the `lib/nginx/includes/security/crs4/rules` directory
66
+ 3. Disable rules for windows in `lib/nginx/includes/security/crs4/rules/REQUEST-932-APPLICATION-ATTACK-RCE.conf`
@@ -5,6 +5,7 @@ proxy_send_timeout 3600;
5
5
  proxy_pass_header server;
6
6
 
7
7
  proxy_headers_hash_bucket_size 512;
8
+ proxy_buffering off;
8
9
  proxy_buffer_size 10k;
9
10
  proxy_next_upstream error timeout invalid_header;
10
11
  proxy_redirect off;
@@ -185,16 +185,40 @@
185
185
  # - id: 920350 (IP address in host header)
186
186
  # - tag: attack-disclosure (all RESPONSE-*-DATA-LEAKAGES rules)
187
187
  #
188
- # SecRule REMOTE_ADDR "@ipMatch 10.0.0.0/8" \
189
- # "id:1005,\
190
- # phase:1,\
191
- # pass,\
192
- # nolog,\
193
- # chain"
194
- # SecRule REQUEST_METHOD "@pm GET HEAD" "chain"
195
- # SecRule REQUEST_HEADERS:User-Agent "@pm ELB-HealthChecker" \
196
- # "ctl:ruleRemoveById=911100,\
197
- # ctl:ruleRemoveById=913100,\
198
- # ctl:ruleRemoveById=920280,\
199
- # ctl:ruleRemoveById=920350,\
200
- # ctl:ruleRemoveByTag=attack-disclosure"
188
+ SecRule REMOTE_ADDR "@ipMatch 10.0.0.0/8" \
189
+ "id:1005,\
190
+ phase:1,\
191
+ pass,\
192
+ nolog,\
193
+ chain"
194
+ SecRule REQUEST_METHOD "@pm GET HEAD" "chain"
195
+ SecRule REQUEST_HEADERS:User-Agent "@pm ELB-HealthChecker" \
196
+ "ctl:ruleRemoveById=911100,\
197
+ ctl:ruleRemoveById=913100,\
198
+ ctl:ruleRemoveById=920280,\
199
+ ctl:ruleRemoveById=920350,\
200
+ ctl:ruleRemoveByTag=attack-disclosure"
201
+
202
+ # Disable some rules for GraphQL API endpoint for blocklet server and service
203
+ SecRule REQUEST_FILENAME "@endsWith /api/gql" \
204
+ "id:1006,\
205
+ phase:1,\
206
+ pass,\
207
+ nolog,\
208
+ chain"
209
+ SecRule REQUEST_METHOD "@pm POST" \
210
+ "ctl:ruleRemoveByTag=attack-sqli,\
211
+ ctl:ruleRemoveByTag=attack-rce,\
212
+ ctl:ruleRemoveByTag=attack-xss"
213
+
214
+ # Disable some rules for websocket endpoint for blocklet server and service
215
+ SecRule REQUEST_FILENAME "@endsWith /websocket" \
216
+ "id:1007,\
217
+ phase:1,\
218
+ pass,\
219
+ nolog,\
220
+ chain"
221
+ SecRule REQUEST_METHOD "@pm GET" \
222
+ "chain"
223
+ SecRule REQUEST_HEADERS:Upgrade "@streq websocket" \
224
+ "ctl:ruleRemoveByTag=attack-protocol"
@@ -28,6 +28,7 @@
28
28
  #
29
29
  # ModSecurity Rule Exclusion: Disable PHP injection rules
30
30
  # SecRuleRemoveByTag "attack-injection-php"
31
+ SecRuleRemoveByTag "platform-windows"
31
32
 
32
33
  #
33
34
  # Example Exclusion Rule: To unconditionally remove parameter "foo" from
@@ -11,6 +11,7 @@ const getPort = require('get-port');
11
11
  const uniqBy = require('lodash/uniqBy');
12
12
  const pick = require('lodash/pick');
13
13
  const camelCase = require('lodash/camelCase');
14
+ const lowerCase = require('lodash/lowerCase');
14
15
  const isEmpty = require('lodash/isEmpty');
15
16
  const formatBackSlash = require('@abtnode/util/lib/format-back-slash');
16
17
  const {
@@ -386,7 +387,7 @@ class NginxProvider extends BaseProvider {
386
387
 
387
388
  if (config['add-module']) {
388
389
  const modulePaths = Array.isArray(config['add-module']) ? config['add-module'] : [config['add-module']];
389
- capabilities.modsecurity = modulePaths.some((x) => x.includes('modsecurity'));
390
+ capabilities.modsecurity = modulePaths.some((x) => lowerCase(x).includes('modsecurity'));
390
391
  }
391
392
 
392
393
  return capabilities;
@@ -98,8 +98,8 @@ module.exports = ({
98
98
  # - In Apache, you can use ErrorDocument to show a friendly error page or
99
99
  # perform a redirect: https://httpd.apache.org/docs/2.4/custom-error.html
100
100
  #
101
- SecDefaultAction "phase:1,log,auditlog,pass"
102
- SecDefaultAction "phase:2,log,auditlog,pass"
101
+ # SecDefaultAction "phase:1,log,auditlog,pass"
102
+ # SecDefaultAction "phase:2,log,auditlog,pass"
103
103
 
104
104
  # Example: Anomaly Scoring mode, log only to ModSecurity audit log
105
105
  # - By default, offending requests are blocked with an error 403 response.
@@ -118,8 +118,8 @@ SecDefaultAction "phase:2,log,auditlog,pass"
118
118
  # - In Apache, you can use ErrorDocument to show a friendly error page or
119
119
  # perform a redirect: https://httpd.apache.org/docs/2.4/custom-error.html
120
120
  #
121
- # SecDefaultAction "phase:1,log,auditlog,deny,status:403"
122
- # SecDefaultAction "phase:2,log,auditlog,deny,status:403"
121
+ SecDefaultAction "phase:1,log,auditlog,deny,status:403"
122
+ SecDefaultAction "phase:2,log,auditlog,deny,status:403"
123
123
 
124
124
  # Example: Self-contained mode, redirect back to homepage on blocking
125
125
  # - In this configuration the 'tag' action includes the Host header data in the
@@ -226,16 +226,16 @@ SecDataDir ${tmpDir}
226
226
 
227
227
 
228
228
  # -- Debug log configuration -------------------------------------------------
229
- SecDebugLog ${logDir}/modsecurity.log
229
+ SecDebugLog ${logDir}/modsecurity-debug.log
230
230
  SecDebugLogLevel ${logLevel}
231
231
 
232
232
  # -- Audit log configuration -------------------------------------------------
233
233
  SecAuditEngine RelevantOnly
234
234
  SecAuditLogRelevantStatus "^(?:5|4(?!04))"
235
235
  SecAuditLogParts ABIJDEFHZ
236
- SecAuditLogType Concurrent
237
- SecAuditLog /dev/null
238
- # SecAuditLog ${logDir}/modsecurity-audit.log
236
+ SecAuditLogType Serial
237
+ SecAuditLogFormat Native
238
+ SecAuditLog ${logDir}/modsecurity.log
239
239
 
240
240
  SecArgumentSeparator &
241
241
  SecCookieFormat 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/router-provider",
3
- "version": "1.16.38-beta-20250118-033334-2da05ae8",
3
+ "version": "1.16.38-beta-20250120-112111-55c032e8",
4
4
  "description": "Routing engine implementations for abt node",
5
5
  "author": "polunzh <polunzh@gmail.com>",
6
6
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
@@ -32,10 +32,10 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/constant": "1.16.38-beta-20250118-033334-2da05ae8",
36
- "@abtnode/logger": "1.16.38-beta-20250118-033334-2da05ae8",
37
- "@abtnode/router-templates": "1.16.38-beta-20250118-033334-2da05ae8",
38
- "@abtnode/util": "1.16.38-beta-20250118-033334-2da05ae8",
35
+ "@abtnode/constant": "1.16.38-beta-20250120-112111-55c032e8",
36
+ "@abtnode/logger": "1.16.38-beta-20250120-112111-55c032e8",
37
+ "@abtnode/router-templates": "1.16.38-beta-20250120-112111-55c032e8",
38
+ "@abtnode/util": "1.16.38-beta-20250120-112111-55c032e8",
39
39
  "@arcblock/http-proxy": "^1.19.1",
40
40
  "@arcblock/is-valid-domain": "^1.0.5",
41
41
  "axios": "^1.7.9",
@@ -60,5 +60,5 @@
60
60
  "bluebird": "^3.7.2",
61
61
  "fs-extra": "^11.2.0"
62
62
  },
63
- "gitHead": "55a983304e72e5e54d6425acd0e2dad1f710aad3"
63
+ "gitHead": "adcb4f0e35157f6645e10e7ef53f8fdeff6953ec"
64
64
  }