feat: 加固标题抓取并加上限流与可选入站令牌

This commit is contained in:
2026-10-09 15:51:50 +08:00
parent bf56c2bd46
commit f091fe691d
9 changed files with 710 additions and 11 deletions
+3
View File
@@ -28,6 +28,9 @@ const app = Fastify({
redact: ["req.headers.authorization"], // 永不记录密钥
},
connectionTimeout: 180_000, // 3 min
// 安全-03:请求体上限。抓取标题与 AI 任务参数都是小报文,
// 没有上限时超大 body 可以打爆内存。
bodyLimit: Number(process.env.LPT_AI_BODY_LIMIT_BYTES ?? 256 * 1024),
});
await app.register(aiRoutes);