fix: 数据集更新接口不支持 API Key 鉴权 (#7006) (#7123)
问题 (#7006):
通过 API Key 调用知识库更新接口(api/core/dataset/update)返回 403
unAuthorization。API Key 可正常使用 list/create/delete,唯独 update 报错。
根因:
update.ts 中 authDataset/authUserPer 调用缺少 authApiKey: true。
parseHeaderCert() 默认 authApiKey=false,API Key 鉴权分支不会被执行,
请求走到末尾被拒绝。
对比其他端点:
- create.ts — authDataset({ authApiKey: true, ... }) ✓
- collection/create.ts — authDataset({ authApiKey: true, ... }) ✓
- collection/list.ts — authDataset({ authApiKey: true, ... }) ✓
- update.ts — authDataset 和 authUserPer 均缺少 authApiKey ✗
改动:
update.ts 四处调用各添加 authApiKey: true:
1. authDataset 主入口 Read 权限检查 (L88)
2. authDataset 移动目标文件夹 Manage 权限检查 (L109)
3. authDataset 移动源文件夹 Manage 权限检查 (L122)
4. authUserPer 移动至/从根目录的团队创建权限检查 (L132)
测试:
新增 projects/app/test/api/core/dataset/update.test.ts:
- token 认证更新数据集
- API Key 认证更新数据集
Fixes #7006
Signed-off-by: DadaVinqi <DadaVinqi@users.noreply.github.com>
Co-authored-by: DadaVinqi <DadaVinqi@users.noreply.github.com>
Showing
Please
register
or
sign in
to comment