fix(libhttp,dnfs2): HttpClient 新增超时接口,dnfs2 启用配置超时

修复 dnfs2 审计 L-3(P2-N5):

libhttp HttpClient 硬编码 CURLOPT_TIMEOUT=30L/CONNECTTIMEOUT=10L,
dnfs2 的 gateway_timeout/review_timeout 配置加载后从未使用,实际超时恒为 30s。

修复:
- libhttp HttpClient 新增 set_timeout/set_connect_timeout 接口
  (默认 30s/10s,向后兼容 gateway/core)
- request_stream_sync 使用成员变量替代硬编码值
- dnfs2 decode_token 设置 gateway_timeout
- dnfs2 review_content 设置 review_timeout

安全评级 A- → A,已知限制 6→5 项。
This commit is contained in:
qing committed 2026-08-08 01:33:57 +08:00
1 parent 9804838e96
commit 117fc0241e
5 files changed
+70 -16

No files matched your search

+5 -3
View File
@@ -80,6 +80,8 @@ timeout = 5
## 已知限制(P2,设计决策不修复)
- P2-12: 错误响应可能泄露信息(新实现已尽量脱敏)
- P2-13: CORS 反射任意 Origin(内部服务绑 127.0.0.1,可接受)
- P2-15: pid 判断已加严格类型校验,但未完全对齐 Python 语义
- L-1: update_note 允许创建循环(需图遍历检测后代关系)
- L-2: delete_note TOCTOU 残余(需 db2 事务支持)
- L-4: 无速率限制(gateway/WAF 职责)
- L-5: title/content 无最大长度校验
- L-6: AI 审核不可用时阻断写入(fail-closed 设计决策)
+2
View File
@@ -643,6 +643,7 @@ private:
HttpClient http;
http.set_max_response_size(kHttpMaxResponse);
http.set_timeout(static_cast<long>(_cfg.gateway_timeout));
http.set_header("Content-Type: application/json");
http.set_header("Authorization: Bearer " + token);
@@ -704,6 +705,7 @@ private:
bool review_content(const std::string& content) {
HttpClient http;
http.set_max_response_size(kHttpMaxResponse);
http.set_timeout(static_cast<long>(_cfg.review_timeout));
http.set_header("Content-Type: application/json");
json::object payload;