fix: 修复工作流公共 API 调用问题

- 限制远程文档仅访问公网地址并校验重定向目标

- 统一访问令牌 401/403 与过期执行状态 404 语义

- 校正节点查询参数和工作流状态文档
This commit is contained in:
2026-07-31 11:27:37 +08:00
parent 1cbee6b018
commit 41b056b7e3
12 changed files with 953 additions and 33 deletions

View File

@@ -50,7 +50,7 @@ public class SysApiKeyServiceImpl extends ServiceImpl<SysApiKeyMapper, SysApiKey
wm.in(SysApiKeyResourceMapping::getApiKeyResourceId, resourceIds);
long count = mappingService.count(wm);
if (count == 0) {
throw new BusinessException("该apiKey无权限访问该接口");
throw new BusinessException(403, 403, "该apiKey无权限访问该接口");
}
}
@@ -70,11 +70,11 @@ public class SysApiKeyServiceImpl extends ServiceImpl<SysApiKeyMapper, SysApiKey
QueryWrapper w = QueryWrapper.create();
w.eq(SysApiKey::getApiKey, apiKey);
SysApiKey one = getOne(w);
if (one == null || one.getStatus() == 0) {
throw new BusinessException("apiKey 不存在或已禁用");
if (one == null || !Integer.valueOf(1).equals(one.getStatus())) {
throw new BusinessException(401, 401, "apiKey 不存在或已禁用");
}
if (one.getExpiredAt() != null && one.getExpiredAt().getTime() < new Date().getTime()) {
throw new BusinessException("apiKey 已过期");
throw new BusinessException(401, 401, "apiKey 已过期");
}
return one;
}
@@ -107,7 +107,7 @@ public class SysApiKeyServiceImpl extends ServiceImpl<SysApiKeyMapper, SysApiKey
globalScopeWrapper.isNull(SysApiKeyResourceMapping::getResourceTargetId);
globalScopeWrapper.eq(SysApiKeyResourceMapping::getActionScope, actionScope);
if (mappingService.count(globalScopeWrapper) == 0) {
throw new BusinessException("该apiKey无权限访问当前资源");
throw new BusinessException(403, 403, "该apiKey无权限访问当前资源");
}
}