fix: validate swipe restaurant ids against room candidates
This commit is contained in:
@@ -38,7 +38,12 @@
|
||||
- 后端补充房间号格式校验与明确错误提示;
|
||||
- 增加 E2E 用例覆盖“手输邀请码加入”。
|
||||
|
||||
### P0-2 投票接口未校验 `restaurantId` 是否属于房间候选列表(可污染房间状态)
|
||||
### P0-2 投票接口未校验 `restaurantId` 是否属于房间候选列表(可污染房间状态)【已完成】
|
||||
- 修复状态:✅ 已完成(2026-03-03)
|
||||
- 修复内容:
|
||||
- `POST /api/room/[id]/swipe` 增加 `restaurantId` 必须属于当前房间候选列表的强校验;
|
||||
- 对非法 `restaurantId` 返回 400;
|
||||
- 增加对应 API 测试用例,防止状态污染回归。
|
||||
- 证据:
|
||||
- `src/app/api/room/[id]/swipe/route.ts:25`(仅查 index)
|
||||
- `src/app/api/room/[id]/swipe/route.ts:32-42`(即使 `restaurantIndex === -1` 仍可写入 `likes` 并可能设置 `match`)
|
||||
|
||||
Reference in New Issue
Block a user