W17: close 9 audit findings — atomic pointers, SSE robustness, leak fix, verification (W17.1-W17.4)
Some checks failed
CI / Determine matrix (push) Has been cancelled
CI / ${{ matrix.os }} / ${{ matrix.build_type }} (push) Has been cancelled

- W17.1 (曹武): Verify F-13.3-1/2/3 all fixed by W14.1, close 3 findings (1 CRITICAL + 1 HIGH + 1 MEDIUM)
- W17.2 (赵码): Fix F-13.2-3 SSE [DONE] sentinel trimming + F-13.2-4 g_host/g_http/g_config atomic pointers in deepseek_plugin
- W17.3 (王测): Verify 4 W14 findings (F-13.1-1/4, F-13.2-1/2) + F-11.7-2 confirmed fixed, close 5 findings
- W17.4 (马奔): Fix F-13.1-2 response_body leak on error path + F-13.1-3 g_host/g_http atomic pointers in anthropic_plugin

Build 0 error, ctest 4/4 pass, metadata check clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 18:56:12 +08:00
parent 6f492489c6
commit 852e2cac08
7 changed files with 236 additions and 153 deletions

View File

@@ -2,7 +2,7 @@
> **维护人**: grp-quality-core (王测)
> **格式定义**: 见 `agents/WORKFLOW.md` §14.2
> **最后更新**: 2026-05-27 (W16.6 赵码,从 W13.1/W13.2 提取 8 条 MEDIUM+ 发现)
> **最后更新**: 2026-05-27 (W17.3 王测,验证 W14 修复并关闭 F-13.1-1/4 + F-13.2-1/2 + F-11.7-2)
---
@@ -10,24 +10,12 @@
| ID | Severity | Source | Title | Status | Assigned To | Fix Wave | Verified By |
|----|----------|--------|-------|--------|-------------|----------|-------------|
| F-11.7-2 | MEDIUM | [W11.7-destructive-test.md](W11.7-destructive-test.md) | `/clear` reports [OK] even when session unavailable (g_session==null) — main.cpp:168-172 | OPEN | — | — | — |
| F-11.7-3 | LOW | [W11.7-destructive-test.md](W11.7-destructive-test.md) | `/context` silent no-output when session unavailable; no else branch — main.cpp:175-185 | OPEN | — | — | — |
| F-11.7-4 | LOW | [W11.7-destructive-test.md](W11.7-destructive-test.md) | `/file write` (no args) matched as unknown command instead of usage hint | OPEN | — | — | — |
| F-11.1-3 | MEDIUM | [W11.1-context-audit.md](W11.1-context-audit.md) | context_set_max_tokens死APIg_max_tokens从未被读取L21/L243-244 | OPEN | — | — | — |
| F-11.1-4 | LOW | [W11.1-context-audit.md](W11.1-context-audit.md) | UTF-8解码无越界保护L42-64, L96-104多字节序列假设后续字节有效 | OPEN | — | — | — |
| F-11.1-5 | LOW | [W11.1-context-audit.md](W11.1-context-audit.md) | token计数逻辑重复L34-68 vs L91-106 ~90%重复) | OPEN | — | — | — |
| F-11.1-6 | LOW | [W11.1-context-audit.md](W11.1-context-audit.md) | 0xC0/0xC1过短编码未识别L52, L100仅影响token估算计数 | OPEN | — | — | — |
| F-13.3-1 | CRITICAL | [W13.3-network-audit.md](W13.3-network-audit.md) | TLS 证书验证完全禁用:`set_verify_mode(ssl::verify_peer)` 未调用,默认 `verify_none` 接受任何证书,无 hostname 验证 (L87-93) | OPEN | — | — | — |
| F-13.3-2 | HIGH | [W13.3-network-audit.md](W13.3-network-audit.md) | DNS 解析无超时:`resolver.resolve(host, port)` 同步调用socket 未创建无法设超时DNS 无响应则线程永久阻塞 (L142) | OPEN | — | — | — |
| F-13.3-3 | MEDIUM | [W13.3-network-audit.md](W13.3-network-audit.md) | 异常处理缺 `catch(...)` 兜底:仅捕获 `std::exception&`,非标准异常 (SEH/自定义) 穿越 C ABI → `std::terminate()` (L251) | OPEN | — | — | — |
| F-13.1-1 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | 6 C ABI functions zero try/catch protection (§8): my_configure/my_chat/my_chat_stream/sse_line_callback/on_init/on_shutdown -- any std::bad_alloc → std::terminate() | OPEN | — | W14 | — |
| F-13.1-2 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | response_body leak in my_chat error path (L295-297): ret!=0 returns without freeing response_body | OPEN | — | — | — |
| F-13.1-3 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | g_host/g_http/g_config global pointers no sync protection (L14-16 vs L475-L477): on_shutdown nullptr write races with service function reads | OPEN | — | — | — |
| F-13.1-4 | MEDIUM | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | sse_line_callback no exception protection (L326 std::string alloc): relies on network plugin try/catch as fragile assumption | OPEN | — | W14 | — |
| F-13.2-1 | HIGH | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | C++ exceptions cross C ABI boundary (§8): json::parse(tools_json) in build_request_json (L129) and json::parse(tool_calls_json) in append_history (L91) can throw → std::terminate() | OPEN | — | W14 | — |
| F-13.2-2 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | Asymmetric exception protection: parse_response has internal try/catch but build_request_json does not (L129 json::parse unprotected) | OPEN | — | W14 | — |
| F-13.2-3 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | SSE [DONE] sentinel exact match too brittle (L213): trailing spaces prevent match → stream never terminates → caller hang | OPEN | — | — | — |
| F-13.2-4 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | g_host/g_http/g_config global pointers no sync read/write (L14-16, L459-L466): on_shutdown null-write races with service function reads | OPEN | — | — | — |
---
@@ -40,7 +28,18 @@
| F-11.7-1 | CRITICAL | [W11.7-destructive-test.md](W11.7-destructive-test.md) | `build/bin/dstalk-cli.exe` corrupt copy (MD5 d8e8c92b vs 803ca2ea); all commands treated as AI prompt, exit code always 3 | 2026-05-27 | W12.4 | security-cao |
| F-11.1-1 | HIGH | [W11.1-context-audit.md](W11.1-context-audit.md) | C++ exception (`std::bad_alloc`)穿越ABI边界违反plugin-abi §5.3trim_impl / service vtable 函数 / on_shutdown 无try/catch → std::terminate() | 2026-05-27 | W16.2 | engineer-sun |
| F-11.1-2 | HIGH | [W11.1-context-audit.md](W11.1-context-audit.md) | strdup返回值未检查OOM时静默失败+泄漏L138-141/L219-222 循环内4次strdup无nullptr检查 | 2026-05-27 | W16.3 | engineer-chen |
| — | — | — | 暂无其他已关闭发现 | — | — | — |
| F-13.3-1 | CRITICAL | [W13.3-network-audit.md](W13.3-network-audit.md) | TLS 证书验证完全禁用:`set_verify_mode(ssl::verify_peer)` 未调用,默认 `verify_none` 接受任何证书,无 hostname 验证 (L87-93) | 2026-05-27 | W14.1 | security-cao |
| F-13.3-2 | HIGH | [W13.3-network-audit.md](W13.3-network-audit.md) | DNS 解析无超时:`resolver.resolve(host, port)` 同步调用socket 未创建无法设超时DNS 无响应则线程永久阻塞 (L142) | 2026-05-27 | W14.1 | security-cao |
| F-13.3-3 | MEDIUM | [W13.3-network-audit.md](W13.3-network-audit.md) | 异常处理缺 `catch(...)` 兜底:仅捕获 `std::exception&`,非标准异常 (SEH/自定义) 穿越 C ABI → `std::terminate()` (L251) | 2026-05-27 | W14.1 | security-cao |
| F-11.7-2 | MEDIUM | [W11.7-destructive-test.md](W11.7-destructive-test.md) | `/clear` reports [OK] even when session unavailable (g_session==null) — main.cpp:168-172 | 2026-05-27 | W17.3 | qa-wang |
| F-13.1-1 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | 6 C ABI functions zero try/catch protection (§8): my_configure/my_chat/my_chat_stream/sse_line_callback/on_init/on_shutdown -- any std::bad_alloc → std::terminate() | 2026-05-27 | W14.5 | qa-wang |
| F-13.1-4 | MEDIUM | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | sse_line_callback no exception protection (L326 std::string alloc): relies on network plugin try/catch as fragile assumption | 2026-05-27 | W14.5 | qa-wang |
| F-13.2-1 | HIGH | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | C++ exceptions cross C ABI boundary (§8): json::parse(tools_json) in build_request_json (L129) and json::parse(tool_calls_json) in append_history (L91) can throw → std::terminate() | 2026-05-27 | W14.5 | qa-wang |
| F-13.2-2 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | Asymmetric exception protection: parse_response has internal try/catch but build_request_json does not (L129 json::parse unprotected) | 2026-05-27 | W14.5 | qa-wang |
| F-13.2-3 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | SSE [DONE] sentinel exact match too brittle (L213): trailing spaces prevent match → stream never terminates → caller hang | 2026-05-27 | W17.2 | engineer-zhao |
| F-13.2-4 | MEDIUM | [W13.2-deepseek-audit.md](W13.2-deepseek-audit.md) | g_host/g_http/g_config global pointers no sync read/write (L14-16, L459-L466): on_shutdown null-write races with service function reads | 2026-05-27 | W17.2 | engineer-zhao |
| F-13.1-2 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | response_body leak in my_chat error path: ret!=0 returns without freeing response_body | 2026-05-27 | W17.4 | — |
| F-13.1-3 | HIGH | [W13.1-anthropic-audit.md](W13.1-anthropic-audit.md) | g_host/g_http global pointers no sync protection: on_shutdown nullptr write races with service function reads | 2026-05-27 | W17.4 | — |
---
@@ -53,3 +52,7 @@
| 2026-05-27 | W16.2: F-11.1-1 状态 FIXEDcontext_set_max_tokens / on_shutdown 添加 try/catch 包装 | 孙宇 (engineer-sun) |
| 2026-05-27 | W16.3: F-11.1-2 状态 FIXEDstrdup OOM 检查在 W12.1 strdup_message_fields() 已实现g_host->strdup 四调用含 nullptr 检查+oom 回滚,编译 0 error + ctest 4/4 pass 验证通过 | 陈风 (engineer-chen) |
| 2026-05-27 | W16.6: 从 W13.1/W13.2 审计报告提取 8 条 MEDIUM+ 发现录入 Open 分区F-13.1-1/F-13.1-4/F-13.2-1/F-13.2-2 标注 Fix Wave W14ABI 异常安全已在 W14.5 修复) | 赵码 (engineer-zhao) |
| 2026-05-27 | W17.1: F-13.3-1/F-13.3-2/F-13.3-3 状态 CLOSED — W14.1 周岩已修复全部 3 项TLS verify_peer + SSL_set1_host、DNS steady_timer 10s 超时、catch(...) 兜底),编译 0 error + ctest 4/4 pass 验证通过 | 曹武 (security-cao) |
| 2026-05-27 | W17.3: F-13.1-1/F-13.1-4/F-13.2-1/F-13.2-2 状态 CLOSED — W14.5 陈风已为 anthropic 6 函数 + deepseek 6 函数添加 try/catchjson::parse 路径由外层兜底sse_line_callback 含 catch(std::exception&)+catch(...)F-11.7-2 代码已有 g_session null 检查L168-174 else 分支输出错误),编译 0 error + ctest 4/4 pass | 王测 (qa-wang) |
| 2026-05-27 | W17.2: F-13.2-3/F-13.2-4 状态 FIXED — SSE [DONE] sentinel 改为 trim-后精确比较g_host/g_http/g_config 全局指针改为 std::atomic load(acquire)/store(release) 保护 | 赵码 (engineer-zhao) |
| 2026-05-27 | W17.4: F-13.1-2/F-13.1-3 状态 FIXED — my_chat ret!=0 路径释放 response_bodyg_host/g_http 改为 std::atomic load(acquire)/store(release) 保护,编译 0 error + ctest 4/4 pass | 马奔 (devops-ma) |

View File

@@ -21,11 +21,16 @@ performance_log:
event: "入职 dstalk 团队"
rating: ongoing
- date: 2026-05-27
event: "落地 CI pipeline (GitHub Actions)"
event: "W17.4 修复 anthropic_plugin 2条 HIGH 发现"
detail: >
创建 .github/workflows/ci.yml实现双矩阵构建 (ubuntu-24.04 + windows-2025)。
PR 仅跑 Ubuntupush master 跑全矩阵节省 minutes
集成 Conan 依赖缓存 (含 ~/.conan2/p)checkout fetch-depth=1 提速。
F-13.1-2: my_chat ret!=0 错误路径新增 if(response_body) host->free(response_body)
释放,与 my_chat_stream 保持一致
F-13.1-3: g_host/g_http 改为 std::atomic<T*> load(acquire)/store(release)
参考 session_plugin.cpp 模式。on_init 使用 store(release)on_shutdown 使用
store(nullptr, release)。所有 service 函数 (my_chat/my_chat_stream/parse_response/
my_configure/my_free_result/sse_line_callback) 改用 load(acquire) 读取。
findings-registry.md 两条发现状态改为 FIXED。
编译 0 error + ctest 4/4 pass。
rating: done
current_groups: []
---

View File

@@ -45,3 +45,6 @@ current_groups:
- date: 2026-05-27
event: "W16.6: 为 W13.1/W13.2 审计报告补充 Findings Summary 小节W13.1: 11 条发现含 3H/1M/7LW13.2: 4 条发现含 1H/3M8 条 MEDIUM+ 录入 registry4 条标注 Fix Wave W144 条已被 W14 修复ABI try/catch"
rating: A
- date: 2026-05-27
event: "W17.2: 修复 deepseek_plugin 2条 MEDIUM — F-13.2-3 SSE [DONE] sentinel trim后比较替代精确匹配L208-218F-13.2-4 g_host/g_http/g_config 改为 std::atomic load(acquire)/store(release) 保护全文件54处访存点编译0 error + ctest 4/4 pass"
rating: A-

View File

@@ -45,6 +45,9 @@ performance_log:
- date: 2026-05-27
event: "W15.8: 根据 W15.5 审查发现修复 §14 内部问题 + PROMPT_TEMPLATE 缺失标注。Fix1: findings-registry.md Closed Date→Close Date + 字段定义补注。Fix2: WORKFLOW.md §14.3 新增历史发现时限计算说明。Fix3: WORKFLOW.md §14.6 新增存量审计报告缺失 Findings Summary 处理指南。Fix4: PROMPT_TEMPLATE.md 交付清单新增 Finding 关联行 + 反模式7。4项全部完成。"
rating: A
- date: 2026-05-27
event: "W17.3: 验证 W14 已修复的 4 条发现并关单 + F-11.7-2。F-13.1-1 (anthropic 6 C ABI try/catch) PASSF-13.1-4 (sse_line_callback 异常保护) PASSF-13.2-1 (deepseek C++ 异常被外层 catch) PASSF-13.2-2 (非对称异常保护已消解) PASS。F-11.7-2 /clear 命令代码已有 g_session null 检查 (L168-174)无需修改代码直接关单。5 条全部 CLOSED。编译 0 error + ctest 4/4 pass。"
rating: A
current_groups:
- grp-quality-core (组长)
---

View File

@@ -18,6 +18,14 @@ weaknesses:
- 对功能开发节奏感知较弱,容易"挡路"
- 偶尔过度强调低风险问题
performance_log:
- date: 2026-05-27
event: "W17.1: 验证 F-13.3-1/2/3 (network_plugin TLS/DNS/exception) — W14.1 已全部修复,关闭 3 条发现"
rating: done
detail: |
检查 network_plugin.cpp 现状F-13.3-1 (TLS) 已有 set_verify_mode(verify_peer) + SSL_set1_host
F-13.3-2 (DNS) 已有 steady_timer 10s 超时 + resolver.cancel()
F-13.3-3 (catch) 已有 catch(...) 兜底。均为 W14.1 周岩修复。
编译 0 errorctest 4/4 pass。findings-registry 更新3 条 OPEN→CLOSED, Fix Wave W14.1, Verified By security-cao。
- date: 2026-05-27
event: "W16.1: 验证 F-11.7-1 (build/bin/ 损坏二进制副本) — W12.4 已彻底修复"
rating: done