From 4bdf9e2cd4ba3f8a24f21d33972ab66f37ff5b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 21 Sep 2026 22:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E6=98=8E=E5=BA=94=E7=94=A8=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=8A=95=E5=BD=B1=E4=B8=BA=E4=BB=80=E4=B9=88=E5=AF=B9?= =?UTF-8?q?=E5=B7=B2=E8=84=B1=E6=95=8F=20detail=20=E5=86=8D=E8=BF=87?= =?UTF-8?q?=E4=B8=80=E9=81=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 原注释写「只再按应用日志预算截一次」,实现却是完整脱敏流水线,合同与实现不一致 - 采纳方式是把合同写实:detail/metadata/summary 都在这里脱敏;已脱敏的 detail 也走同一遍,理由是截断会切开脱敏标记,且这是 pub(crate) 边界不假设调用方先脱敏 - 未采纳「去掉再脱敏改为只截断」:该建议会把安全性绑定在调用方自觉上,收益只是一次可忽略的 canonicalize - 验证:rustfmt(注释改动,无行为变化) --- .../ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs index bf0d8103e..b6bfab1fc 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent/runtime_error.rs @@ -139,6 +139,9 @@ pub(crate) fn persist_agent_runtime_error( /// stderr,那里没有 `sanitize_diagnostic_message` 兜底,所以每个调用方给的外来文本 /// (`summary` 按 320 字符预算)都在这里过一遍脱敏。 /// +/// 已经脱敏过的 `detail` 也照走同一遍流水线,不按「调用方已脱敏」走短路:截断会把 +/// `[redacted-secret]` 这类标记切开,而且这里是 `pub(crate)` 边界,不假设未来调用方一定先脱敏。 +/// /// 拆成「身份行 + 详情行」是因为整行只要出现凭据标记就会被 /// [`crate::sanitize_diagnostic_message`] 整体替换成脱敏占位,详情行可能因此消失; /// 身份行保持短小且只含摘要与引用,保证事件还能被定位。