@abtnode/router-provider 1.16.38-beta-20250116-083413-dbd33222 → 1.16.38-beta-20250118-033334-2da05ae8

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.
Files changed (51) hide show
  1. package/lib/nginx/includes/security/crs4/rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example +200 -0
  2. package/lib/nginx/includes/security/crs4/rules/REQUEST-901-INITIALIZATION.conf +470 -0
  3. package/lib/nginx/includes/security/crs4/rules/REQUEST-905-COMMON-EXCEPTIONS.conf +57 -0
  4. package/lib/nginx/includes/security/crs4/rules/REQUEST-911-METHOD-ENFORCEMENT.conf +76 -0
  5. package/lib/nginx/includes/security/crs4/rules/REQUEST-913-SCANNER-DETECTION.conf +86 -0
  6. package/lib/nginx/includes/security/crs4/rules/REQUEST-920-PROTOCOL-ENFORCEMENT.conf +1915 -0
  7. package/lib/nginx/includes/security/crs4/rules/REQUEST-921-PROTOCOL-ATTACK.conf +558 -0
  8. package/lib/nginx/includes/security/crs4/rules/REQUEST-922-MULTIPART-ATTACK.conf +120 -0
  9. package/lib/nginx/includes/security/crs4/rules/REQUEST-930-APPLICATION-ATTACK-LFI.conf +203 -0
  10. package/lib/nginx/includes/security/crs4/rules/REQUEST-931-APPLICATION-ATTACK-RFI.conf +189 -0
  11. package/lib/nginx/includes/security/crs4/rules/REQUEST-932-APPLICATION-ATTACK-RCE.conf +1875 -0
  12. package/lib/nginx/includes/security/crs4/rules/REQUEST-933-APPLICATION-ATTACK-PHP.conf +774 -0
  13. package/lib/nginx/includes/security/crs4/rules/REQUEST-934-APPLICATION-ATTACK-GENERIC.conf +366 -0
  14. package/lib/nginx/includes/security/crs4/rules/REQUEST-941-APPLICATION-ATTACK-XSS.conf +1071 -0
  15. package/lib/nginx/includes/security/crs4/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf +1978 -0
  16. package/lib/nginx/includes/security/crs4/rules/REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION.conf +132 -0
  17. package/lib/nginx/includes/security/crs4/rules/REQUEST-944-APPLICATION-ATTACK-JAVA.conf +463 -0
  18. package/lib/nginx/includes/security/crs4/rules/REQUEST-949-BLOCKING-EVALUATION.conf +270 -0
  19. package/lib/nginx/includes/security/crs4/rules/RESPONSE-950-DATA-LEAKAGES.conf +156 -0
  20. package/lib/nginx/includes/security/crs4/rules/RESPONSE-951-DATA-LEAKAGES-SQL.conf +417 -0
  21. package/lib/nginx/includes/security/crs4/rules/RESPONSE-952-DATA-LEAKAGES-JAVA.conf +108 -0
  22. package/lib/nginx/includes/security/crs4/rules/RESPONSE-953-DATA-LEAKAGES-PHP.conf +158 -0
  23. package/lib/nginx/includes/security/crs4/rules/RESPONSE-954-DATA-LEAKAGES-IIS.conf +152 -0
  24. package/lib/nginx/includes/security/crs4/rules/RESPONSE-955-WEB-SHELLS.conf +558 -0
  25. package/lib/nginx/includes/security/crs4/rules/RESPONSE-959-BLOCKING-EVALUATION.conf +280 -0
  26. package/lib/nginx/includes/security/crs4/rules/RESPONSE-980-CORRELATION.conf +138 -0
  27. package/lib/nginx/includes/security/crs4/rules/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf.example +76 -0
  28. package/lib/nginx/includes/security/crs4/rules/iis-errors.data +59 -0
  29. package/lib/nginx/includes/security/crs4/rules/java-classes.data +64 -0
  30. package/lib/nginx/includes/security/crs4/rules/java-code-leakages.data +17 -0
  31. package/lib/nginx/includes/security/crs4/rules/java-errors.data +10 -0
  32. package/lib/nginx/includes/security/crs4/rules/lfi-os-files.data +722 -0
  33. package/lib/nginx/includes/security/crs4/rules/php-config-directives.data +571 -0
  34. package/lib/nginx/includes/security/crs4/rules/php-errors-pl2.data +7 -0
  35. package/lib/nginx/includes/security/crs4/rules/php-errors.data +2147 -0
  36. package/lib/nginx/includes/security/crs4/rules/php-function-names-933150.data +245 -0
  37. package/lib/nginx/includes/security/crs4/rules/php-function-names-933151.data +2201 -0
  38. package/lib/nginx/includes/security/crs4/rules/php-variables.data +30 -0
  39. package/lib/nginx/includes/security/crs4/rules/restricted-files.data +284 -0
  40. package/lib/nginx/includes/security/crs4/rules/restricted-upload.data +177 -0
  41. package/lib/nginx/includes/security/crs4/rules/scanners-user-agents.data +119 -0
  42. package/lib/nginx/includes/security/crs4/rules/sql-errors.data +172 -0
  43. package/lib/nginx/includes/security/crs4/rules/ssrf.data +177 -0
  44. package/lib/nginx/includes/security/crs4/rules/unix-shell.data +670 -0
  45. package/lib/nginx/includes/security/crs4/rules/web-shells-php.data +167 -0
  46. package/lib/nginx/includes/security/crs4/rules/windows-powershell-commands.data +425 -0
  47. package/lib/nginx/includes/security/unicode.mapping +96 -0
  48. package/lib/nginx/index.js +50 -3
  49. package/lib/nginx/templates/security/crs4/crs-setup.conf.js +857 -0
  50. package/lib/nginx/templates/security/modsecurity.conf.js +244 -0
  51. package/package.json +7 -6
@@ -0,0 +1,244 @@
1
+ /* eslint-disable */
2
+ // mode: DetectionOnly | On
3
+ module.exports = ({
4
+ mode,
5
+ logLevel,
6
+ tmpDir,
7
+ logDir,
8
+ }) => `# -- Rule engine initialization ----------------------------------------------
9
+
10
+ # Enable ModSecurity, attaching it to every transaction. Use detection
11
+ # only to start with, because that minimises the chances of post-installation
12
+ # disruption.
13
+ #
14
+ # SecRuleEngine DetectionOnly
15
+ SecRuleEngine ${mode}
16
+
17
+ # -- Request body handling ---------------------------------------------------
18
+ SecRequestBodyAccess On
19
+
20
+ # Enable XML request body parser.
21
+ # Initiate XML Processor in case of xml content-type
22
+ #
23
+ SecRule REQUEST_HEADERS:Content-Type "^(?:application(?:/soap\+|/)|text/)xml" \
24
+ "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML"
25
+
26
+ # Enable JSON request body parser.
27
+ # Initiate JSON Processor in case of JSON content-type; change accordingly
28
+ # if your application does not use 'application/json'
29
+ #
30
+ SecRule REQUEST_HEADERS:Content-Type "^application/json" \
31
+ "id:'200001',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
32
+
33
+ # Sample rule to enable JSON request body parser for more subtypes.
34
+ # Uncomment or adapt this rule if you want to engage the JSON
35
+ # Processor for "+json" subtypes
36
+ #
37
+ #SecRule REQUEST_HEADERS:Content-Type "^application/[a-z0-9.-]+[+]json" \
38
+ # "id:'200006',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON"
39
+
40
+ # Maximum request body size we will accept for buffering. If you support
41
+ # file uploads then the value given on the first line has to be as large
42
+ # as the largest file you are willing to accept. The second value refers
43
+ # to the size of data, with files excluded. You want to keep that value as
44
+ # low as practical.
45
+ #
46
+ SecRequestBodyLimit 13107200
47
+ SecRequestBodyNoFilesLimit 131072
48
+
49
+ # What to do if the request body size is above our configured limit.
50
+ # Keep in mind that this setting will automatically be set to ProcessPartial
51
+ # when SecRuleEngine is set to DetectionOnly mode in order to minimize
52
+ # disruptions when initially deploying ModSecurity.
53
+ #
54
+ SecRequestBodyLimitAction Reject
55
+
56
+ # Maximum parsing depth allowed for JSON objects. You want to keep this
57
+ # value as low as practical.
58
+ #
59
+ SecRequestBodyJsonDepthLimit 512
60
+
61
+ # Maximum number of args allowed per request. You want to keep this
62
+ # value as low as practical. The value should match that in rule 200007.
63
+ SecArgumentsLimit 1000
64
+
65
+ # If SecArgumentsLimit has been set, you probably want to reject any
66
+ # request body that has only been partly parsed. The value used in this
67
+ # rule should match what was used with SecArgumentsLimit
68
+ SecRule &ARGS "@ge 1000" \
69
+ "id:'200007', phase:2,t:none,log,deny,status:400,msg:'Failed to fully parse request body due to large argument count',severity:2"
70
+
71
+ # Verify that we've correctly processed the request body.
72
+ # As a rule of thumb, when failing to process a request body
73
+ # you should reject the request (when deployed in blocking mode)
74
+ # or log a high-severity alert (when deployed in detection-only mode).
75
+ #
76
+ SecRule REQBODY_ERROR "!@eq 0" \
77
+ "id:'200002', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2"
78
+
79
+ # By default be strict with what we accept in the multipart/form-data
80
+ # request body. If the rule below proves to be too strict for your
81
+ # environment consider changing it to detection-only. You are encouraged
82
+ # _not_ to remove it altogether.
83
+ #
84
+ SecRule MULTIPART_STRICT_ERROR "!@eq 0" \
85
+ "id:'200003',phase:2,t:none,log,deny,status:400, \
86
+ msg:'Multipart request body failed strict validation: \
87
+ PE %{REQBODY_PROCESSOR_ERROR}, \
88
+ BQ %{MULTIPART_BOUNDARY_QUOTED}, \
89
+ BW %{MULTIPART_BOUNDARY_WHITESPACE}, \
90
+ DB %{MULTIPART_DATA_BEFORE}, \
91
+ DA %{MULTIPART_DATA_AFTER}, \
92
+ HF %{MULTIPART_HEADER_FOLDING}, \
93
+ LF %{MULTIPART_LF_LINE}, \
94
+ SM %{MULTIPART_MISSING_SEMICOLON}, \
95
+ IQ %{MULTIPART_INVALID_QUOTING}, \
96
+ IP %{MULTIPART_INVALID_PART}, \
97
+ IH %{MULTIPART_INVALID_HEADER_FOLDING}, \
98
+ FL %{MULTIPART_FILE_LIMIT_EXCEEDED}'"
99
+
100
+ # Did we see anything that might be a boundary?
101
+ #
102
+ # Here is a short description about the ModSecurity Multipart parser: the
103
+ # parser returns with value 0, if all "boundary-like" line matches with
104
+ # the boundary string which given in MIME header. In any other cases it returns
105
+ # with different value, eg. 1 or 2.
106
+ #
107
+ # The RFC 1341 descript the multipart content-type and its syntax must contains
108
+ # only three mandatory lines (above the content):
109
+ # * Content-Type: multipart/mixed; boundary=BOUNDARY_STRING
110
+ # * --BOUNDARY_STRING
111
+ # * --BOUNDARY_STRING--
112
+ #
113
+ # First line indicates, that this is a multipart content, second shows that
114
+ # here starts a part of the multipart content, third shows the end of content.
115
+ #
116
+ # If there are any other lines, which starts with "--", then it should be
117
+ # another boundary id - or not.
118
+ #
119
+ # After 3.0.3, there are two kinds of types of boundary errors: strict and permissive.
120
+ #
121
+ # If multipart content contains the three necessary lines with correct order, but
122
+ # there are one or more lines with "--", then parser returns with value 2 (non-zero).
123
+ #
124
+ # If some of the necessary lines (usually the start or end) misses, or the order
125
+ # is wrong, then parser returns with value 1 (also a non-zero).
126
+ #
127
+ # You can choose, which one is what you need. The example below contains the
128
+ # 'strict' mode, which means if there are any lines with start of "--", then
129
+ # ModSecurity blocked the content. But the next, commented example contains
130
+ # the 'permissive' mode, then you check only if the necessary lines exists in
131
+ # correct order. Whit this, you can enable to upload PEM files (eg "----BEGIN.."),
132
+ # or other text files, which contains eg. HTTP headers.
133
+ #
134
+ # The difference is only the operator - in strict mode (first) the content blocked
135
+ # in case of any non-zero value. In permissive mode (second, commented) the
136
+ # content blocked only if the value is explicit 1. If it 0 or 2, the content will
137
+ # allowed.
138
+ #
139
+
140
+ #
141
+ # See #1747 and #1924 for further information on the possible values for
142
+ # MULTIPART_UNMATCHED_BOUNDARY.
143
+ #
144
+ SecRule MULTIPART_UNMATCHED_BOUNDARY "@eq 1" \
145
+ "id:'200004',phase:2,t:none,log,deny,msg:'Multipart parser detected a possible unmatched boundary.'"
146
+
147
+
148
+ # PCRE Tuning
149
+ # We want to avoid a potential RegEx DoS condition
150
+ #
151
+ SecPcreMatchLimit 10240
152
+ SecPcreMatchLimitRecursion 10240
153
+
154
+ # Some internal errors will set flags in TX and we will need to look for these.
155
+ # All of these are prefixed with "MSC_". The following flags currently exist:
156
+ #
157
+ # MSC_PCRE_LIMITS_EXCEEDED: PCRE match limits were exceeded.
158
+ #
159
+ SecRule TX:/^MSC_/ "!@streq 0" \
160
+ "id:'200005',phase:2,t:none,log,deny,msg:'ModSecurity internal error flagged: %{MATCHED_VAR_NAME}'"
161
+
162
+
163
+ # -- Response body handling --------------------------------------------------
164
+
165
+ # Allow ModSecurity to access response bodies.
166
+ # You should have this directive enabled in order to identify errors
167
+ # and data leakage issues.
168
+ #
169
+ # Do keep in mind that enabling this directive does increases both
170
+ # memory consumption and response latency.
171
+ #
172
+ SecResponseBodyAccess Off
173
+
174
+ # Which response MIME types do you want to inspect? You should adjust the
175
+ # configuration below to catch documents but avoid static files
176
+ # (e.g., images and archives).
177
+ #
178
+ SecResponseBodyMimeType text/plain text/html text/xml
179
+
180
+ # Buffer response bodies of up to 512 KB in length.
181
+ SecResponseBodyLimit 524288
182
+
183
+ # What happens when we encounter a response body larger than the configured
184
+ # limit? By default, we process what we have and let the rest through.
185
+ # That's somewhat less secure, but does not break any legitimate pages.
186
+ #
187
+ SecResponseBodyLimitAction ProcessPartial
188
+
189
+
190
+ # -- Filesystem configuration ------------------------------------------------
191
+
192
+ # The location where ModSecurity stores temporary files (for example, when
193
+ # it needs to handle a file upload that is larger than the configured limit).
194
+ #
195
+ # This default setting is chosen due to all systems have /tmp available however,
196
+ # this is less than ideal. It is recommended that you specify a location that's private.
197
+ #
198
+ SecTmpDir ${tmpDir}
199
+
200
+ # The location where ModSecurity will keep its persistent data. This default setting
201
+ # is chosen due to all systems have /tmp available however, it
202
+ # too should be updated to a place that other users can't access.
203
+ #
204
+ SecDataDir ${tmpDir}
205
+
206
+
207
+ # -- File uploads handling configuration -------------------------------------
208
+
209
+ # The location where ModSecurity stores intercepted uploaded files. This
210
+ # location must be private to ModSecurity. You don't want other users on
211
+ # the server to access the files, do you?
212
+ #
213
+ #SecUploadDir /opt/modsecurity/var/upload/
214
+
215
+ # By default, only keep the files that were determined to be unusual
216
+ # in some way (by an external inspection script). For this to work you
217
+ # will also need at least one file inspection rule.
218
+ #
219
+ #SecUploadKeepFiles RelevantOnly
220
+
221
+ # Uploaded files are by default created with permissions that do not allow
222
+ # any other user to access them. You may need to relax that if you want to
223
+ # interface ModSecurity to an external program (e.g., an anti-virus).
224
+ #
225
+ #SecUploadFileMode 0600
226
+
227
+
228
+ # -- Debug log configuration -------------------------------------------------
229
+ SecDebugLog ${logDir}/modsecurity.log
230
+ SecDebugLogLevel ${logLevel}
231
+
232
+ # -- Audit log configuration -------------------------------------------------
233
+ SecAuditEngine RelevantOnly
234
+ SecAuditLogRelevantStatus "^(?:5|4(?!04))"
235
+ SecAuditLogParts ABIJDEFHZ
236
+ SecAuditLogType Concurrent
237
+ SecAuditLog /dev/null
238
+ # SecAuditLog ${logDir}/modsecurity-audit.log
239
+
240
+ SecArgumentSeparator &
241
+ SecCookieFormat 0
242
+
243
+ SecStatusEngine Off
244
+ `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/router-provider",
3
- "version": "1.16.38-beta-20250116-083413-dbd33222",
3
+ "version": "1.16.38-beta-20250118-033334-2da05ae8",
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,14 +32,15 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/constant": "1.16.38-beta-20250116-083413-dbd33222",
36
- "@abtnode/logger": "1.16.38-beta-20250116-083413-dbd33222",
37
- "@abtnode/router-templates": "1.16.38-beta-20250116-083413-dbd33222",
38
- "@abtnode/util": "1.16.38-beta-20250116-083413-dbd33222",
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",
39
39
  "@arcblock/http-proxy": "^1.19.1",
40
40
  "@arcblock/is-valid-domain": "^1.0.5",
41
41
  "axios": "^1.7.9",
42
42
  "debug": "^4.3.7",
43
+ "fast-glob": "^3.3.2",
43
44
  "find-process": "^1.4.7",
44
45
  "fkill": "^7.2.1",
45
46
  "fs-extra": "^11.2.0",
@@ -59,5 +60,5 @@
59
60
  "bluebird": "^3.7.2",
60
61
  "fs-extra": "^11.2.0"
61
62
  },
62
- "gitHead": "df865bfafb04c5cecc29f07b2f40d9154af00598"
63
+ "gitHead": "55a983304e72e5e54d6425acd0e2dad1f710aad3"
63
64
  }