fix(push): 完善厂商推送排障日志 #198

Merged
guke merged 1 commits from fix-pushlog into main 2026-07-30 10:41:44 +08:00
Member
No description provided.
zuochenyong added 1 commit 2026-07-29 19:54:05 +08:00
Member

🤖 review-pr 深审结论

🟡 需关注(置信度 0.85)— 排障日志改得扎实、35 项 push 测试全过;但有一处厂商鉴权凭据明文入日志。

实跑(worktree 合并最新 main)

  • pytest tests/test_push_center.py tests/test_device_push.py35 passed;ruff 干净
  • time/hashlib/json 均已导入(无 NameError);10 个 _request_json/_request_form 调用点都补齐了必填 vendor=/operation=

问题

  • [med] 安全:厂商 OAuth access_token 明文进日志 — 请求侧精心脱敏了 accesstoken/authtoken 等键,但响应侧走 _raw_log_summary(不脱敏),而 honor/huawei/vivo/oppo 的 authenticate 响应体正好带 access_token/authToken/auth_token。本 PR 自带的 test_vendor_http_logs_device_token_raw_response_and_elapsed 就断言 "raw-access-token" in messages → 厂商 bearer token 会以 INFO 落盘。虽短期、仅推送权限,但与本 PR「不暴露服务端鉴权凭据」目标不一致。建议 authenticate 类响应改走 _log_summary(已能脱敏 accesstoken/authtoken 键)或给响应摘要加一层脱敏。

正面:vendor/operation/endpoint/elapsed_ms 结构化、单条长度上限、递归深度/键数护栏都到位;device token 刻意保留用于排障投递,内部日志可接受。

⚠️ 合并级冲突(与 #199,必看):#198 把 _request_json/_request_formvendor/operation 改成必填;#199 新增的 _send_honor_data/_send_huawei_data/_send_xiaomi_data+vivo 10089 回退调用时没传这两参。git 能干净自动合并、无文本冲突,但实跑证实合并后调用 _send_xiaomi_dataTypeError: _request_form() missing 2 required keyword-only arguments: 'vendor' and 'operation'。谁后合谁必须给这些新 data 调用补 vendor=/operation=,rebase 后重跑 pytest tests/test_push_center.py

只读深审 · worktree 合并最新 main · 已实跑

## 🤖 review-pr 深审结论 🟡 **需关注**(置信度 0.85)— 排障日志改得扎实、35 项 push 测试全过;但有一处厂商鉴权凭据明文入日志。 **实跑(worktree 合并最新 main)** - ✅ `pytest tests/test_push_center.py tests/test_device_push.py` → **35 passed**;ruff 干净 - ✅ `time/hashlib/json` 均已导入(无 NameError);10 个 `_request_json/_request_form` 调用点都补齐了必填 `vendor=/operation=` **问题** - **[med] 安全:厂商 OAuth access_token 明文进日志** — 请求侧精心脱敏了 `accesstoken/authtoken` 等键,但响应侧走 `_raw_log_summary`(不脱敏),而 honor/huawei/vivo/oppo 的 authenticate 响应体正好带 `access_token`/`authToken`/`auth_token`。本 PR 自带的 `test_vendor_http_logs_device_token_raw_response_and_elapsed` 就断言 `"raw-access-token" in messages` → 厂商 bearer token 会以 INFO 落盘。虽短期、仅推送权限,但与本 PR「不暴露服务端鉴权凭据」目标不一致。建议 authenticate 类响应改走 `_log_summary`(已能脱敏 accesstoken/authtoken 键)或给响应摘要加一层脱敏。 **正面**:vendor/operation/endpoint/elapsed_ms 结构化、单条长度上限、递归深度/键数护栏都到位;device token 刻意保留用于排障投递,内部日志可接受。 **⚠️ 合并级冲突(与 #199,必看)**:#198 把 `_request_json/_request_form` 的 `vendor/operation` 改成**必填**;#199 新增的 `_send_honor_data/_send_huawei_data/_send_xiaomi_data`+vivo 10089 回退调用时**没传**这两参。git 能干净自动合并、无文本冲突,但实跑证实合并后调用 `_send_xiaomi_data` 抛 `TypeError: _request_form() missing 2 required keyword-only arguments: 'vendor' and 'operation'`。谁后合谁必须给这些新 data 调用补 `vendor=/operation=`,rebase 后重跑 `pytest tests/test_push_center.py`。 <sub>只读深审 · worktree 合并最新 main · 已实跑</sub>
guke merged commit 675c7ecf81 into main 2026-07-30 10:41:44 +08:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: WonderableAI/shaguabijia-app-server#198