Issue I5EE0S:在后端与数据库网络连接异常时,ruoyi-admin响应给客户端的异常信息包含大量的SQL语句等敏感信息。

This commit is contained in:
liudun 2022-06-27 22:31:10 +08:00
parent acf8ea428f
commit 11c7be092e
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,8 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.security.PermissionUtils;
import java.sql.SQLException;
/**
* 全局异常处理器
*
@ -105,6 +107,14 @@ public class GlobalExceptionHandler
return AjaxResult.error(message);
}
/**
* 处理数据库连接异常屏蔽数据库敏感信息响应e.getMessage()会导致客户端看到SQL语句等
*/
@ExceptionHandler(SQLException.class)
public AjaxResult dbException(){
return AjaxResult.error("系统出现数据库异常!");
}
/**
* 演示模式异常
*/