chore(security): redact absolute paths in error responses and publish SHA256SUMS - #512
Merged
liujuanjuan1984 merged 2 commits intoAug 22, 2026
Merged
Conversation
Collaborator
Author
|
独立代码审查完成,发现并收敛 2 处问题(提交
|
3 tasks
liujuanjuan1984
marked this pull request as ready for review
August 22, 2026 16:06
liujuanjuan1984
deleted the
chore/error-redaction-release-checksums-511
branch
August 22, 2026 16:06
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.
背景
对齐 codex-a2a #346(残余低风险加固)实施。opencode-a2a 安全审计 #499 已收口,但其拆解范围未包含错误响应路径脱敏与发布物校验清单;对照 codex-a2a #346 的修复清单(codex-a2a PR #353)逐一核查后确认同类风险仍存在(见 #511)。
变更内容
opencode_a2a.redact确定性脱敏工具:POSIX/Windows/UNC 绝对路径与file://本地 URI 替换为<redacted-path>占位符;远程 URL、相对路径、普通文本与 API 路由 token(/message:send、/tasks/{id}:cancel)保持不变;幂等;redact_paths_in_value递归覆盖 dict/list/tuple/str。execution/executor.py:_emit_error(SSE 与 task 错误消息/artifact)jsonrpc/error_responses.py:adapt_jsonrpc_error(message、metadata 值、标准 JSON-RPC 错误码 data)jsonrpc/error_responses.py:build_http_error_body(REST 错误体)jsonrpc/application.py:_generate_error_response(新增覆写,覆盖 SDK 基类对裸异常/标准错误码的原样透出).github/workflows/publish.yml在上传前生成dist/SHA256SUMS(sha256sum 格式、按文件名排序、确定性),并作为 release asset 上传;已存在时幂等跳过。docs/security-architecture.md:新增 Security Controls 章节(错误文本脱敏策略与边界、发布完整性),并更新维护规则;登记 [chore] 残余低风险加固:错误响应路径脱敏与发布物完整性校验 #511 中记录的补充观察(upstream 远端 detail 文本属远端内容信任面,另行评估,不在本 PR 范围)。jsonrpc/application.py新增_build_error_payload统一序列化适配后的错误(_generate_protocol_error_response复用)。修复存量缺陷——opencode 自有JSONRPCError经error_response回调进入 SDK 基类时会被str()包装成-32603垃圾消息;现在保持结构化 code/message/data 并完成脱敏。/message:send元数据不被误脱敏)、JSON-RPC 错误序列化回归(session_not_found_error/upstream_payload_error结构化透出且脱敏)。对照核查结论(详见 #511)
_emit_error、adapt_jsonrpc_error(message/metadata/标准码 data)、build_http_error_body、裸异常兜底、handlerdetail=str(exc)、发布物无校验清单。tool_error_mapping.py已返回稳定错误串;本地 exec/subprocess runtime(不适用)。upstream_error_translator将远端响应文本拼入客户端消息,属远端内容信任面,建议单独评估。验证
./scripts/doctor.sh全部通过(pre-commit、mypy、811 passed、覆盖率 93.23%、构建与 wheel smoke)。test_rest_message_parsing_helpers_cover_upgrade_paths、test_dual_stack_send_rejects_cross_transport_payload_shapes)保持绿。相关提交
30a5728chore(security): redact absolute paths in error responses and publish SHA256SUMS ([chore] 残余低风险加固:错误响应路径脱敏与发布物完整性校验 #511)c49c462fix(server): serialize adapted JSON-RPC errors without SDK string wrapping ([chore] 残余低风险加固:错误响应路径脱敏与发布物完整性校验 #511)验收标准对照
_emit_error、adapt_jsonrpc_error(message/metadata/标准错误码 data)、build_http_error_body、裸异常兜底分支docs/security-architecture.md记录错误脱敏与发布完整性策略及边界关联 issue