fix(系统设置): 操作日志对集成的平台账户密码显示为明文
--bug=1022910 --user=李玉号 【系统设置】github#21736,操作日志对集成的平台账户密码显示为明文 https://www.tapd.cn/55049933/s/1335012 Closes #21736
This commit is contained in:
parent
039d681c8a
commit
fca3fde8fc
|
@ -1,8 +1,10 @@
|
||||||
package io.metersphere.log.utils;
|
package io.metersphere.log.utils;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import io.metersphere.commons.constants.OperLogModule;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
import io.metersphere.commons.utils.JSON;
|
import io.metersphere.commons.utils.JSON;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
@ -211,6 +213,29 @@ public class ReflexObjectUtil {
|
||||||
String oldValue = Objects.toString(column.getOriginalValue(), "");
|
String oldValue = Objects.toString(column.getOriginalValue(), "");
|
||||||
column.setDiffValue(ApiTestEnvironmentDiffUtil.diff(newValue, oldValue));
|
column.setDiffValue(ApiTestEnvironmentDiffUtil.diff(newValue, oldValue));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// 不记录服务集成配置信息中密码字段
|
||||||
|
else if (StringUtils.equals(module, OperLogModule.WORKSPACE_SERVICE_INTEGRATION)) {
|
||||||
|
if (StringUtils.equals(column.getColumnName(), "configuration")) {
|
||||||
|
if (column.getNewValue() != null && column.getOriginalValue() == null) {
|
||||||
|
HashMap<String, Object> newConf = JSON.parseObject((String) column.getNewValue(), new TypeReference<>() {});
|
||||||
|
newConf.put("password", "******");
|
||||||
|
column.setNewValue(JSON.toJSONString(newConf));
|
||||||
|
} else if (column.getOriginalValue() != null && column.getNewValue() != null) {
|
||||||
|
HashMap<String, Object> newConf = JSON.parseObject((String) column.getNewValue(), new TypeReference<>() {});
|
||||||
|
HashMap<String, Object> oldConf = JSON.parseObject((String) column.getOriginalValue(), new TypeReference<>() {});
|
||||||
|
if (StringUtils.equals((String)newConf.get("password"), (String)oldConf.get("password"))) {
|
||||||
|
// 密码未修改,保持一致
|
||||||
|
oldConf.put("password", "******");
|
||||||
|
newConf.put("password", "******");
|
||||||
|
} else {
|
||||||
|
oldConf.put("password", "******");
|
||||||
|
newConf.put("password", "*********");
|
||||||
|
}
|
||||||
|
column.setOriginalValue(JSON.toJSONString(oldConf));
|
||||||
|
column.setNewValue(JSON.toJSONString(newConf));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
String newValue = Objects.toString(column.getNewValue(), "");
|
String newValue = Objects.toString(column.getNewValue(), "");
|
||||||
if (StringUtils.isNotEmpty(newValue)) {
|
if (StringUtils.isNotEmpty(newValue)) {
|
||||||
|
|
Loading…
Reference in New Issue