fix: 修复多项后端缺陷并加固安全与限流

- 修正 AI 会话表初始化及异步数据库 URI 处理
- 新增全局 API 与 WS 聊天限流,健康检查豁免
- 修复忘记密码接口防用户枚举与参数校验
- 修复 SSE 推送数据重复编码问题
- 修复 Cron 表达式 Quartz 问号兼容
- 修复存储模块权限标识前缀
- 新增过期日志清理与任务错误中文提示
This commit is contained in:
zhangtao
2026-09-07 00:08:00 +08:00
parent 30dfc7097b
commit a8d29d4ab4
59 changed files with 989 additions and 891 deletions
@@ -16,7 +16,7 @@ StorageWorkflowRouter = APIRouter(route_class=OperationLogRoute, prefix="/storag
@StorageWorkflowRouter.get("/page", summary="分页查询传输流程", response_model=ResponseSchema[PageResultSchema[WorkflowOutSchema]])
async def get_flow_page_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:query"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:query"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
page: Annotated[PaginationQueryParam, Depends()],
search: Annotated[WorkflowQueryParam, Query()],
@@ -32,7 +32,7 @@ async def get_flow_page_controller(
@StorageWorkflowRouter.get("/list", summary="查询传输流程列表", response_model=ResponseSchema[list[WorkflowOutSchema]])
async def get_flow_list_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:query"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:query"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
search: Annotated[WorkflowQueryParam, Query()],
) -> JSONResponse:
@@ -42,7 +42,7 @@ async def get_flow_list_controller(
@StorageWorkflowRouter.get("/detail/{id}", summary="查询传输流程详情", response_model=ResponseSchema[WorkflowOutSchema])
async def get_flow_detail_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:query"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:query"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
id: Annotated[int, Path(description="流程ID", ge=1)],
) -> JSONResponse:
@@ -52,7 +52,7 @@ async def get_flow_detail_controller(
@StorageWorkflowRouter.post("/create", status_code=status.HTTP_201_CREATED, summary="创建传输流程", response_model=ResponseSchema[WorkflowOutSchema])
async def create_flow_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:create"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:create"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
data: Annotated[WorkflowCreateSchema, Body(description="流程创建参数")],
) -> JSONResponse:
@@ -62,7 +62,7 @@ async def create_flow_controller(
@StorageWorkflowRouter.put("/update/{id}", summary="修改传输流程", response_model=ResponseSchema[WorkflowOutSchema])
async def update_flow_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:update"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:update"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
id: Annotated[int, Path(description="流程ID", ge=1)],
data: Annotated[WorkflowUpdateSchema, Body(description="流程修改参数")],
@@ -73,7 +73,7 @@ async def update_flow_controller(
@StorageWorkflowRouter.delete("/delete", summary="删除传输流程", response_model=ResponseSchema[None])
async def delete_flow_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:flow:delete"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:flow:delete"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
ids: Annotated[list[int], Body(description="流程ID列表")],
) -> JSONResponse:
@@ -83,7 +83,7 @@ async def delete_flow_controller(
@StorageWorkflowRouter.post("/execute/{id}", summary="执行传输流程", response_model=ResponseSchema[list[int]])
async def execute_flow_controller(
auth: Annotated[AuthSchema, Security(AuthPermission(["module_storage:workflow:transfer:create"]))],
auth: Annotated[AuthSchema, Security(AuthPermission(["module_task:storage:transfer:create"]))],
db: Annotated[AsyncSession, Depends(db_getter)],
id: Annotated[int, Path(description="流程ID", ge=1)],
data: Annotated[WorkflowExecuteSchema | None, Body(description="执行参数(源文件/目录路径映射,可选)")] = None,