Skip to content

[Privacy] Centralize redaction and data minimization for logs, diagnostics, traces, and eval artifacts #19

Open

Description

@helsome

Background

Folio 已经有 credential store,但 credential 安全不等于运行数据安全。接入 #14 Langfuse、评测输出、diagnostics、错误日志后,prompt、tool arguments、HTTP metadata、retrieved content、stack trace 中都可能意外携带 API Key、cookie、token、用户私密内容或连接信息。

需要在所有“数据离开核心 runtime”的边界前建立统一 redaction / data-minimization 层,避免每个 logger、telemetry adapter 和 export 各自处理。

Requirements

建立统一 sanitizer/redactor,并在以下出口复用:

  • application / kernel logs;
  • diagnostics bundle;
  • Langfuse / telemetry payload;
  • eval JSON / JSONL / summary artifacts;
  • error / exception serialization;
  • report/debug export 中的运行元数据。

至少处理:

  • Authorization / bearer token;
  • provider API keys;
  • cookies / session tokens;
  • credential store 读取结果;
  • connection strings / webhook secrets;
  • tool args / tool results 中出现的上述值;
  • URL query/header 中的 secret;
  • exception message / stack / HTTP body 中意外回显的 secret。

同时定义数据最小化策略:

  • 哪些 prompt/source/attachment 内容默认允许写入 telemetry;
  • 哪些只记录 hash / length / metadata;
  • 哪些必须完全不记录;
  • 对 full-content tracing 必须显式 opt-in,而不是默认上传全部用户内容。

Redaction 应尽量在统一 transport boundary 前完成,而不是依赖 UI 隐藏。

Acceptance Criteria

  • 有一个可复用的统一 redaction/sanitization contract,日志、diagnostics、Langfuse 和 eval artifacts 使用同一规则源或共享实现。
  • provider key、Authorization、cookie、connection string 等常见 secret 有自动测试。
  • secret 即使出现在 nested tool args/results、HTTP error、URL query 中也能被处理。
  • 文档明确默认 telemetry content policy,以及如何选择 privacy-safe / full-content 模式。
  • redaction 失败不能导致 secret 以 raw payload fallback 方式被记录。
  • 不应因过度 redaction 破坏 trace 的 run id、tool name、latency、status 等必要可观测字段。
  • 建立 canary secret scanner,可扫描本次测试产生的 logs、diagnostics、eval artifacts 和待发送 telemetry payload。
  • 必须使用 production Agent / Deep Research path 做一次真实运行:人为把 canary secret 放入环境变量、tool input/error 或测试上下文,最终扫描所有产物确认 0 泄漏。仅测试 redact("sk-test") 单元函数不算完成。
  • 如果 [Eval] Integrate Langfuse tracing and evaluation for Agent / Deep Research runs #14 已完成,PR 中同时证明 Langfuse 中不存在 canary secret。

Notes

  • credential store 继续负责“secret at rest”;本 Issue 关注“secret/content in transit and diagnostics”。
  • 测试使用假的 canary secret,禁止把真实 credential 放进 issue、PR 或测试 fixture。

Activity

  1. yc2bgr8 commented on Sep 11, 2026

    @yc2bgr8
    Contributor

    /claim

  2. added
    claimed
    on Sep 11, 2026
  3. github-actions commented on Sep 11, 2026

    @github-actions

    @yc2bgr8 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #19。

  4. yc2bgr8 commented on Sep 11, 2026

    @yc2bgr8
    Contributor

    /release

  5. github-actions commented on Sep 11, 2026

    @github-actions

    该 Issue 已释放,可以重新认领。

  6. removed
    claimed
    on Sep 11, 2026
  7. Rapeter commented on Sep 11, 2026

    @Rapeter
    Contributor

    /claim

  8. added
    claimed
    on Sep 11, 2026
  9. github-actions commented on Sep 11, 2026

    @github-actions

    @Rapeter 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #19。

  10. Rapeter commented on Sep 11, 2026

    @Rapeter
    Contributor

    /release

  11. removed
    claimed
    on Sep 11, 2026
  12. github-actions commented on Sep 11, 2026

    @github-actions

    该 Issue 已释放,可以重新认领。

  13. TINGyu123644 commented on Sep 11, 2026

    @TINGyu123644

    认领这个 issue 👋

    我来负责这个任务:集中化 redaction 和数据最小化,覆盖 logs、diagnostics、traces、eval artifacts。

    我会按照 acceptance criteria 逐步推进:

    1. 先梳理现有散落的脱敏逻辑(export/privacy.ts、diagnostics/redact.ts、evaluation/redactor.ts 等)
    2. 设计统一的 RedactionPipe 接口和规则引擎
    3. 把现有三套脱敏逻辑合并成一套可配置的规则集
    4. 确保所有出口都走统一脱敏:日志、trace、export、telemetry、diagnostics、eval artifact
    5. 加测试:验证 API key、账户余额、持仓数量等敏感字段不会泄露
    6. 确保导出后不包含任何 secret

    如果有任何优先级调整或额外要求,请随时告诉我。

  14. yjg-djb commented on Sep 11, 2026

    @yjg-djb
    Contributor

    /claim

  15. added
    claimed
    on Sep 11, 2026
  16. github-actions commented on Sep 11, 2026

    @github-actions

    @yjg-djb 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #19。

  17. added 4 commits that reference this issue on Sep 11, 2026
    83db04e
    92b1cab
    25af2f8
    2f2de5f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions