From 8d6a2305324438726e7c009c6249aa7aa1319e5f Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期一, 22 八月 2022 10:24:30 +0800
Subject: [PATCH] 优化Context信息,防止泄漏问题
---
src/main/java/com/ruoyi/framework/aspectj/LogAspect.java | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
index 3d8a64d..25f702c 100644
--- a/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
+++ b/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java
@@ -16,6 +16,7 @@
import org.springframework.web.servlet.HandlerMapping;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.enums.HttpMethod;
+import com.ruoyi.common.filter.PropertyPreExcludeFilter;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -37,6 +38,9 @@
public class LogAspect
{
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
+
+ /** 鎺掗櫎鏁忔劅灞炴�у瓧娈� */
+ public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
/**
* 澶勭悊瀹岃姹傚悗鎵ц
@@ -168,7 +172,7 @@
{
try
{
- Object jsonObj = JSON.toJSON(o);
+ String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter());
params += jsonObj.toString() + " ";
}
catch (Exception e)
@@ -181,6 +185,14 @@
}
/**
+ * 蹇界暐鏁忔劅灞炴��
+ */
+ public PropertyPreExcludeFilter excludePropertyPreFilter()
+ {
+ return new PropertyPreExcludeFilter().addExcludes(EXCLUDE_PROPERTIES);
+ }
+
+ /**
* 鍒ゆ柇鏄惁闇�瑕佽繃婊ょ殑瀵硅薄銆�
*
* @param o 瀵硅薄淇℃伅銆�
--
Gitblit v1.9.3