包含: - furniture-3d-system:Next.js 16 全栈应用(资产中心、产品管理、3D装配动画) - autocad-plugin:AutoCAD 家具导出插件源码 - 资产中心改造:编辑弹窗化、删除功能、Toast反馈、自定义Select组件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
title, date, module, problem_type, severity, symptoms, root_cause, resolution_type, status, confidence, tags, related_patterns
| title | date | module | problem_type | severity | symptoms | root_cause | resolution_type | status | confidence | tags | related_patterns | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 嵌套路由 panelId 缺少 productId 归属校验(IDOR) | 2026-02-15 | panel-nested-routes | security_issue | critical |
|
路由层默认信任路径参数,未建立资源归属约束 | code_fix | active | high |
|
|
现象与影响
攻击者可构造“任意 productId + 目标 panelId”请求,在嵌套路由下越权读取或修改其他产品下的板件/孔位。
修复动作
- 在
panel.service.ts新增assertPanelBelongsToProduct(panelId, productId)。 - 在
products/[id]/panels/[panelId]/route.ts与products/[id]/panels/[panelId]/holes/route.ts所有读写入口统一先做归属校验。 panel.service.findById增加canViewProduct权限护栏,并将板件详情 GET 改为认证访问。
验证
npm run type-check -- --pretty false通过npm test -- tests/lib/cad-panel-linking.test.ts --runInBand通过npm test -- tests/api/auth-me.test.ts --runInBand通过
预防策略
- 所有形如
/products/:productId/.../:resourceId的接口,必须执行“resource -> productId 与路径一致”校验。 - 归属校验与权限校验都应在 Service 层有可复用方法,Route 只负责调用。