Files
X-Financial/document/development/2026-07-13/dev-logs/bugs/application-preview-forged-identity.md
2026-07-14 00:07:07 +08:00

9 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 修复记录
- 22:59记录 bug 修复AI 申请预览入口可保留请求体伪造的身份和管理员权限。
- Git 提交检查:已执行 `git fetch --all --prune`,未发现 upstream 新提交;本地 ahead 4 个既有提交,分别为 `22669a90 feat(expenses): show unified expense event timeline`(真实费用事件时间线)、`a616b30c fix(expenses): unify AI application submission transaction`AI 申请提交事务)、`653eda05 feat(auth): add opaque bearer sessions`(不透明 Bearer 会话)和 `661990b2 feat(expenses): add transactional expense case events`Expense Case 事务事件基础)。
- 修改:`reimbursements.py``user_id`、租户、角色、管理员标记、用户名、姓名、部门、职位、职级、员工编号和直属经理全部强制绑定到服务端当前会话,不再对请求体同名字段使用 `setdefault``test_reimbursement_endpoints.py` 增加伪造管理员与他人身份编辑退回申请的对抗用例。
- 操作:先在容器中复现修复前接口返回 200 且允许修改他人申请,再完成服务端身份覆盖;没有修改数据库结构,没有执行迁移或重启服务。
- 验证:修复后恶意请求返回 400目标申请的事由、状态和审批节点保持不变也没有新增费用事件正常保存草稿与直接提交回归通过。本轮受影响后端定向回归共 36 项、前端时间线兼容测试 9 项和 Python `ruff --select F,I` 均在容器内通过。
- 影响AI 工作台快速申请入口不能再通过伪造 `user_id``is_admin`、角色或员工编号绕过申请所有权检查,授权事实与其他受保护接口统一来自服务端会话。