chanjs 2.6.4 → 2.6.5
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/App.js +1 -1
- package/base/Container.js +6 -3
- package/base/Controller.js +2 -1
- package/base/Service.js +20 -1
- package/common/index.js +0 -2
- package/doc/Aop.md +269 -0
- package/doc/Cache.md +160 -0
- package/doc/Common.md +182 -0
- package/doc/Controller.md +152 -0
- package/doc/Email.md +114 -0
- package/doc/Event.md +232 -0
- package/doc/Help.md +789 -0
- package/doc/Service.md +566 -0
- package/helper/cache.js +1 -0
- package/helper/index.js +71 -22
- package/index.js +0 -1
- package/middleware/waf.js +5 -6
- package/package.json +1 -1
- package//345/275/222/346/241/243.zip +0 -0
- package/utils/index.js +0 -4
- /package/{utils → helper}/checker.js +0 -0
- /package/{utils → helper}/keywords.js +0 -0
- /package/{utils → helper}/rate-limit.js +0 -0
- /package/{utils → helper}/response.js +0 -0
- /package/{utils → helper}/xss-filter.js +0 -0
package/middleware/waf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getIp } from "../helper/ip.js";
|
|
2
|
-
import { checkKeywords } from "../
|
|
3
|
-
import { filterXSS } from "../
|
|
4
|
-
import { createRateLimitMiddleware } from "../
|
|
2
|
+
import { checkKeywords } from "../helper/checker.js";
|
|
3
|
+
import { filterXSS } from "../helper/xss-filter.js";
|
|
4
|
+
import { createRateLimitMiddleware } from "../helper/rate-limit.js";
|
|
5
5
|
|
|
6
6
|
function parseCookies(cookieHeader) {
|
|
7
7
|
if (!cookieHeader) return {};
|
|
@@ -60,7 +60,6 @@ function createWafMiddleware(wafConfig) {
|
|
|
60
60
|
|
|
61
61
|
return async (req, res, next) => {
|
|
62
62
|
try {
|
|
63
|
-
console.log('[WAF] 中间件开始执行,enabled:', wafConfig.enabled);
|
|
64
63
|
if (!wafConfig.enabled) {
|
|
65
64
|
console.log('[WAF] WAF已禁用,跳过检查');
|
|
66
65
|
return next();
|
|
@@ -122,7 +121,7 @@ function createWafMiddleware(wafConfig) {
|
|
|
122
121
|
|
|
123
122
|
if (matched) {
|
|
124
123
|
const { category, keyword } = matched;
|
|
125
|
-
console.
|
|
124
|
+
console.error(`[WAF 拦截] IP:${clientIp} 路径:${requestPath} 关键词:${keyword} 类别:${category}`);
|
|
126
125
|
|
|
127
126
|
const htmlResponse = `
|
|
128
127
|
<!DOCTYPE html>
|
|
@@ -148,7 +147,7 @@ function createWafMiddleware(wafConfig) {
|
|
|
148
147
|
</html>
|
|
149
148
|
`;
|
|
150
149
|
|
|
151
|
-
|
|
150
|
+
|
|
152
151
|
return res.status(403).setHeader('Content-Type', 'text/html').send(htmlResponse);
|
|
153
152
|
}
|
|
154
153
|
}
|
package/package.json
CHANGED
|
Binary file
|
package/utils/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { success, fail, error, parseDatabaseError, notFoundResponse, errorResponse } from "./response.js";
|
|
2
|
-
export { checkKeywords, isIgnored } from "./checker.js";
|
|
3
|
-
export { filterXSS } from "./xss-filter.js";
|
|
4
|
-
export { createRateLimitMiddleware } from "./rate-limit.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|