FinClaw V1 Sub-Packet: SensitiveInputHandling 端到端验证
状态:Pending 日期:2026-05-16 Lane:Engineering Owner:Engineering Agent A(agent/) + Eval Agent F Parent Packet:v1-engineering-implementation-task-packet.md 对齐 Action Item:AL-2
1. 目标
对 v1-product-object-and-schema-design.md §9 SensitiveInputHandling 4 类输入做端到端验证:
- ordinary_preference → 轻量保存确认;
- financial_context → 临时使用,保存前确认;
- sensitive_personal_financial → 默认不保存;
- credential_or_permission → 拒收 / 屏蔽 / 不保存 / 不训练 / 不回显。
并扩展 Boundary Guard 拒禁字段集(确保 §5.2 Forbidden Fields 全部 13 个字段在 advisor / object writer 出口处都被拒)。
2. 允许读取
见 frontmatter must_read / reference_only。
3. 禁止范围
- 不允许在拒收路径回显凭证片段(即使在错误日志中);
- 不在 SensitiveInputHandling record 中保留原始凭证字符串(只保留 classification + masking timestamp);
- 不绕过 D-12 隐私边界自行新增字段;
- 不让 sensitive_input_classifier 成为「静默通过」的 Skill(任何 false negative 必须有 evaluation case 覆盖)。
4. Acceptance Criteria
| AC ID | 验收项 |
|---|---|
| AC-1 | SensitiveInputHandling record 字段完整(input_ref / classification / allowed_use / save_allowed / training_allowed / masking_required / rejection_message_ref / review_required) |
| AC-2 | 4 类输入分类器单测:每类输入 ≥ 5 个正例 + 5 个负例 |
| AC-3 | Boundary Guard 单测覆盖:13 个 forbidden execution fields × 7 个 advisor route = 91 个 cell,全部拒禁 |
| AC-4 | Credential 拒收 100% 通过:私钥 / API key / 助记词 / 交易所 key / 钱包地址 5 类共 ≥ 25 个负例 case |
| AC-5 | 新增 evaluation case edge-credential-rejection.yaml,集成到 evaluation/finclaw/cases/ 与工程仓库 evaluation/cases/ |
| AC-6 | Financial context 路径:保存前必须有 ProfileConsent 确认(依赖 sub-1) |
| AC-7 | 拒收提示文案(前端 + API error)短而明确:「当前产品不需要也不接受账户凭证或私钥」(中英双版) |
| AC-8 | 完整 e2e 测试:pytest server/tests/test_sensitive_input_handler.py + test_boundary_guard.py 全部通过 |
5. 回写位置
- 代码 → 工程仓库
fin-claw; - v1-governance-engineering-alignment.md §2 / §3 / §9.AL-2 状态由
partial→aligned-initial; - Hand-off anchor →
handoff-anchors/v1-eng-impl-sub-2-sensitive-input-handling.yaml; - 解除依赖:trial(trial 启动前 sensitive handler 必须已验证)。
6. 风险与裁决项
- 风险 R-1:Classifier false negative 在 trial 中触发凭证泄漏 → 必须有「不能确定时降级为拒收 + 人工复核」回退;
- 风险 R-2:Boundary Guard 拒禁列表与未来 AI Trading Matrix 对接时冲突 → 该对接走独立授权执行系统契约(本 sub-packet 不开口子);
- 裁决项 J-1:「不能确定」是否触发 hard reject vs soft warning 由项目发起人裁决;建议 trial 期内默认 hard reject。
7. 与其他 Sub-Packet 的关系
- 依赖:sub-1(ProfileConsent 用于 financial_context 保存路径);
- 解除:trial sub-2(trial-start gate 前置);
- 共享文件需协调:
server/agent/models.py(与 sub-1 / sub-3 协调)、server/agent/boundary_guard.py(与 sub-7 advisor budget 测试协调)。