| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| data | ||
| public | ||
| scripts | ||
| src | ||
| test | ||
| .env.template | ||
| Dockerfile | ||
| next-i18next.config.js | ||
| next.config.ts | ||
| package.json | ||
| tsconfig.json | ||
| vitest.config.ts |
问题 (#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>
| Name |
Last commit
|
Last Update |
|---|---|---|
| .. | ||
| data | Loading commit data... | |
| public | Loading commit data... | |
| scripts | Loading commit data... | |
| src | Loading commit data... | |
| test | Loading commit data... | |
| .env.template | Loading commit data... | |
| Dockerfile | Loading commit data... | |
| next-i18next.config.js | Loading commit data... | |
| next.config.ts | Loading commit data... | |
| package.json | Loading commit data... | |
| tsconfig.json | Loading commit data... | |
| vitest.config.ts | Loading commit data... |