feat: 添加 sensitive-logs feature flag 控制敏感日志输出#74
Open
BenedictKing wants to merge 1 commit intohank9999:masterfrom
Open
feat: 添加 sensitive-logs feature flag 控制敏感日志输出#74BenedictKing wants to merge 1 commit intohank9999:masterfrom
BenedictKing wants to merge 1 commit intohank9999:masterfrom
Conversation
默认不输出完整请求体日志(仅记录字节数), 启用 sensitive-logs feature 后才输出完整内容。 避免生产环境意外泄露用户对话内容。 使用方式:cargo build --features sensitive-logs
Owner
|
...? 各家debug日志都是输出完整请求内容的吧, 这样改了 开debug还要重新编译啊 |
Owner
|
核心问题 tracing::debug! 本身就是 debug 级别日志。在生产环境中,除非明确设置 这个 PR 的逻辑矛盾
引入了新的问题 用 feature flag 解决的是编译时问题,但实际上这是运行时关注点。如果生产环境出了问题需要临时开启详细日志来排查,现在必须重新编译才能做 正确的做法 如果真的担心敏感信息,应该:
|
Contributor
Author
|
这个我不太确定通用的做法是什么,这是claude给我的方案,我觉得还行就用了 原则上是发布版本不应该包含输出用户输入输出的行为,但是我又想自己测试的时候能追溯问题,所以采取这个方案 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
生产环境中
tracing::debug输出完整 Kiro 请求体可能泄露用户对话内容。实现
Cargo.toml中添加sensitive-logsfeature flag# 调试构建 cargo build --features sensitive-logs改动范围
Cargo.toml: 添加 feature 定义src/anthropic/handlers.rs: 2 处请求体日志改为条件编译