4 Commits

Author SHA1 Message Date
peanut 591f70a2f6 docs: 批量更新历史文档中的 backend-single 引用为 server 2026-06-27 17:27:27 +08:00
peanut 82c308b40a docs: 修复 spec 评审 Round 2 发现的 1 P0 编译错误 + 3 P2 一致性问题
P0 编译错误:
- MediaType.includesCompatibleWith() 不存在于 Spring Framework
  改为 MediaType.APPLICATION_JSON.isCompatibleWith(contentType)
  (避免实现阶段 mvn 编译直接阻塞)

P2 一致性:
- WechatResponseErrorHandler 类注释第 1 条错误('显式重写返回 true')
  改为正确的 '委托父类 4xx/5xx 判断'
- hasError() 方法内联注释自相矛盾
  改为正确的 '委托父类 DefaultResponseErrorHandler.hasError()'
- GlobalExceptionHandler.handleWechatApiException rawBody 日志未脱敏
  (Interceptor 已脱敏响应 body,但 rawBody 字段在异常对象中再次传递会绕过脱敏)
  新增 desensitizeForLog() 方法复用正则,覆盖 code 字段(authorization code 也需脱敏)
- 移除 @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
  (与现有 BusinessException handler 不一致;HTTP 层统一返回 200,业务错误由 Result.code 表达)
2026-06-03 07:42:59 +08:00
peanut 13f773f3f0 docs: 修复 spec 评审 17 个问题(4 P0 阻塞 + 7 P1 重要 + 6 P2 次要)
P0(阻塞):
- BufferingClientHttpRequestFactory 解决响应体流被消费破坏其他 7 个使用点
- WechatApiException 显式 handler 避免泄露原始错误消息给前端
- LoggingInterceptor 脱敏 session_key/openid/unionid 解决敏感信息泄露
- WechatResponseErrorHandler 显式重写 hasError 避免流消费冲突

P1(重要):
- 包结构统一(LoggingInterceptor → interceptor 包,ErrorHandler → config 包)
- WechatApiException 用 HTTP 风格错误码(400/500/502)替代负数
- app-id/app-secret 一致性:都删除硬编码默认值
- WAF 验证改为后端日志验证 UA(不再用 Postman)
- 列出 7 个其他 RestTemplate 使用点逐一评估

P2(次要):
- body 日志改 DEBUG(生产 INFO 不打印)
- 统一 [WeChatAPI] 日志前缀便于 grep
- rawBody 不放在 DTO(保持纯 DTO)
- 增加回滚方案说明
2026-06-03 07:35:50 +08:00
peanut 5631f22566 docs: 修复微信小程序登录 text/plain 错误设计文档(WAF 拦截 + 凭据硬编码) 2026-06-03 07:28:30 +08:00