修复漏洞(对报错信息进行自定义,避免泄露系统敏感信息)
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.framework.web.exception;
|
package com.ruoyi.framework.web.exception;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.highgo.jdbc.util.PSQLException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.access.AccessDeniedException;
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
@@ -98,7 +100,14 @@ public class GlobalExceptionHandler
|
|||||||
{
|
{
|
||||||
String requestURI = request.getRequestURI();
|
String requestURI = request.getRequestURI();
|
||||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||||
return AjaxResult.error(e.getMessage());
|
|
||||||
|
String msg = e.getMessage();
|
||||||
|
if (msg != null && msg.contains("对于字符类型来说这个值太长了")) {
|
||||||
|
return AjaxResult.error("输入内容过长,请检查后重试");
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.error("服务器异常,请稍后重试");
|
||||||
|
//return AjaxResult.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -142,4 +151,12 @@ public class GlobalExceptionHandler
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("演示模式,不允许操作");
|
return AjaxResult.error("演示模式,不允许操作");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拦截瀚高数据库 字符过长异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(PSQLException.class)
|
||||||
|
public AjaxResult handleHighGoException(PSQLException e) {
|
||||||
|
return AjaxResult.error("输入内容过长,请检查后重试");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user