Issue I5EE0S:在后端与数据库网络连接异常时,ruoyi-admin响应给客户端的异常信息包含大量的SQL语句等敏感信息。
This commit is contained in:
parent
acf8ea428f
commit
11c7be092e
|
|
@ -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("系统出现数据库异常!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 演示模式异常
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue