fix: 查重上传接口错误信息不再泄露内部异常(安全审计 P1) #82
Reference in New Issue
Block a user
Delete Branch "fix/p1-duplication-error-info-leak"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
修复内容
apps/api/app/api/routes/duplication.py中两处HTTPException.detail使用 f-string 将内部异常直接暴露给用户:detail=f"读取文件失败: {exc}"detail="文件读取失败,请稍后重试"detail=f"文件上传失败: {exc}"detail="文件上传失败,请稍后重试"同时添加
logger.error(..., exc_info=True)记录完整异常堆栈,方便内部排查。- L150: detail=f"读取文件失败: {exc}" → detail="文件读取失败,请稍后重试" - L162: detail=f"文件上传失败: {exc}" → detail="文件上传失败,请稍后重试" - 添加 logger.error 记录完整异常信息供内部排查