Commit 0c577ddd authored by DeleMing's avatar DeleMing

<dev>

1. 当日志里有多个响应时,姓名,手机号等其他该脱敏字段并未脱敏
parent 1400f1ee
Pipeline #21680 passed with stages
in 2 minutes and 42 seconds
...@@ -148,7 +148,10 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob ...@@ -148,7 +148,10 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob
.append(GeneralConstants.SEMICOLON); .append(GeneralConstants.SEMICOLON);
} }
String[] valueArr = valuesString.split(GeneralConstants.COMMA); String[] valueArr = valuesString.split(GeneralConstants.COMMA);
int valueSize = valueArr.length / keysArr.length; int valueSize = valueArr.length / keysArr.length + 1;
if ((valueArr.length + 1) % (keysArr.length) != 0) {
valueSize = valueArr.length / keysArr.length;
}
List<Integer> ansValueIndex = getAnsValueIndex(valueIndex, valueSize, keysArr.length); List<Integer> ansValueIndex = getAnsValueIndex(valueIndex, valueSize, keysArr.length);
for (int i = 0; i < valueArr.length; i++) { for (int i = 0; i < valueArr.length; i++) {
String value = valueArr[i]; String value = valueArr[i];
...@@ -248,7 +251,10 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob ...@@ -248,7 +251,10 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob
.append(GeneralConstants.SEMICOLON); .append(GeneralConstants.SEMICOLON);
} }
String[] valueArr = valuesString.split(GeneralConstants.COMMA); String[] valueArr = valuesString.split(GeneralConstants.COMMA);
int valueSize = valueArr.length / keysArr.length; int valueSize = valueArr.length / keysArr.length + 1;
if ((valueArr.length + 1) % (keysArr.length) != 0) {
valueSize = valueArr.length / keysArr.length;
}
List<Integer> ansValueIndex = getAnsValueIndex(valueIndex, valueSize, keysArr.length); List<Integer> ansValueIndex = getAnsValueIndex(valueIndex, valueSize, keysArr.length);
for (int i = 0; i < valueArr.length; i++) { for (int i = 0; i < valueArr.length; i++) {
String value = valueArr[i]; String value = valueArr[i];
...@@ -313,7 +319,7 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob ...@@ -313,7 +319,7 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob
/** /**
* 获取ans部分需要脱敏的下标 * 获取ans部分需要脱敏的下标
* *
* @param keyIndex 需要脱敏的key下 * @param keyIndex 需要脱敏的key下
* @param valueSize value的步长 * @param valueSize value的步长
* @param keySize key的步长 * @param keySize key的步长
* @return 需要脱敏的下标 * @return 需要脱敏的下标
...@@ -322,7 +328,11 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob ...@@ -322,7 +328,11 @@ public class DesensitizationFunction<T, R> extends RichFlatMapFunction<Tuple2<Ob
List<Integer> valueIndex = new ArrayList<>(); List<Integer> valueIndex = new ArrayList<>();
for (Integer index : keyIndex) { for (Integer index : keyIndex) {
for (int i = 0; i < valueSize; i++) { for (int i = 0; i < valueSize; i++) {
valueIndex.add(index + keySize * i); if ((index + keySize * i) > keySize) {
valueIndex.add(index + keySize * i - 1);
} else {
valueIndex.add(index + keySize * i);
}
} }
} }
return valueIndex; return valueIndex;
......
...@@ -20,7 +20,7 @@ name: "custname,otherlinkman,longname,YXYHMC,deputyname,name,fundname" ...@@ -20,7 +20,7 @@ name: "custname,otherlinkman,longname,YXYHMC,deputyname,name,fundname"
# 手机号key # 手机号key
mobile: "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call,g_stationaddr,terminalinfo" mobile: "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call,g_stationaddr,terminalinfo"
# 电话号码key # 电话号码key
phone: "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call" phone: "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call,inputinfo,outputinfo"
# 邮箱key # 邮箱key
email: "email" email: "email"
# 身份证号码key # 身份证号码key
......
...@@ -215,7 +215,7 @@ public class DesensitizationFunctionTest { ...@@ -215,7 +215,7 @@ public class DesensitizationFunctionTest {
"&operway=E" + "&operway=E" +
"&orgid=4301" + "&orgid=4301" +
"&terminalinfo=" + "&terminalinfo=" +
"&trdpwd=llu*;@40z@25" + "&trd pwd=llu*;@40z@25" +
  • Remove this hard-coded password. 📘

Please register or sign in to reply
"&serverid=5&g_serverid=5" + "&serverid=5&g_serverid=5" +
"Ans: NodeId=5007, QueueId=430, MsgId=50000006045676B123C23F68, Len=1023, Buf=0130000000000000000030500705007050070A94EF138F7FKCX" + "Ans: NodeId=5007, QueueId=430, MsgId=50000006045676B123C23F68, Len=1023, Buf=0130000000000000000030500705007050070A94EF138F7FKCX" +
"GVZgODkBbGg=5FE8AF66005007000003013739410305 00897000000 141_CA=2.3&_SYSID=5007&_ENDIAN=0&_RS_1=MESSAGE;3;LEVEL,CODE,MSG;" + "GVZgODkBbGg=5FE8AF66005007000003013739410305 00897000000 141_CA=2.3&_SYSID=5007&_ENDIAN=0&_RS_1=MESSAGE;3;LEVEL,CODE,MSG;" +
...@@ -225,7 +225,7 @@ public class DesensitizationFunctionTest { ...@@ -225,7 +225,7 @@ public class DesensitizationFunctionTest {
"custodystate,clearstate,lastprintdate,lastprintway,printip,logindate,logintime,outputinfo,operway," + "custodystate,clearstate,lastprintdate,lastprintway,printip,logindate,logintime,outputinfo,operway," +
"idnoenddate,idnobegindate,outmsg,custstatus,superflag;" + "idnoenddate,idnobegindate,outmsg,custstatus,superflag;" +
"2&_2=1,A641393224,刘梦明,55132633,0,10586706,刘梦明,4301,6004,0,,0,0,55132633,0,0,6CAE8B62900A,E,c,,1,o,0," + "2&_2=1,A641393224,刘梦明,55132633,0,10586706,刘梦明,4301,6004,0,,0,0,55132633,0,0,6CAE8B62900A,E,c,,1,o,0," +
"20200211,0,,20201227,21205975,,012347ADEFGIMNVYcu,,20270906,20170906,您的交易密码已经321天未修改,0,1&_3=2,0278160114," + "20200211,0,,20201227,21205975,,012347ADEFGIMNVYcu,20270906,20170906,您的交易密码已经321天未修改,0,1&_3=2,0278160114," +
"刘梦明,55132633,0,10586706,刘梦明,4301,6004,0,,0,0,55132633,0,0,6CAE8B62900A,E,c,,1,o,0,20200211,0,,20201227,21205975,," + "刘梦明,55132633,0,10586706,刘梦明,4301,6004,0,,0,0,55132633,0,0,6CAE8B62900A,E,c,,1,o,0,20200211,0,,20201227,21205975,," +
"012347ADEFGIMNVYcu,20270906,20170906,您的交易密码已经321天未修改,0,1&_EORS_2=3&_RC=3&_CC=35&_TL=3:1;35:2;"; "012347ADEFGIMNVYcu,20270906,20170906,您的交易密码已经321天未修改,0,1&_EORS_2=3&_RC=3&_CC=35&_TL=3:1;35:2;";
map.put(GeneralConstants.MESSAGE, message); map.put(GeneralConstants.MESSAGE, message);
......
  • SonarQube analysis reported 193 issues

    • 4 blocker
    • 🚫 34 critical
    • 131 major
    • 🔽 21 minor
    • 3 info

    Watch the comments in this conversation to review them.

    Top 30 extra issues

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. Remove this hard-coded password. 📘
    2. Remove this hard-coded password. 📘
    3. Remove this hard-coded password. 📘
    4. 🚫 Define a constant instead of duplicating this literal " {\n" 11 times. 📘
    5. 🚫 [Define a constant instead of duplicating this literal " "type": \n" 11 times. 📘
    6. 🚫 Define a constant instead of duplicating this literal " "string",\n" 6 times. 📘
    7. 🚫 Define a constant instead of duplicating this literal " "null"\n" 6 times. 📘
    8. 🚫 [Define a constant instead of duplicating this literal " ]\n" 11 times.](https://git.zorkdata.com/liaomingtao/transaction-log-desensitization/blob/0c577ddd23052c0842a64243578745b8eebb11bd/src/main/java/com/zorkdata/desensitization/avro/AvroSchemaDef.java#L23) 📘
    9. 🚫 Define a constant instead of duplicating this literal " },\n" 9 times. 📘
    10. 🚫 Define a constant instead of duplicating this literal " "null",\n" 5 times. 📘
    11. 🚫 Define a constant instead of duplicating this literal " {\n" 5 times. 📘
    12. 🚫 Define a constant instead of duplicating this literal " "type": "map",\n" 5 times. 📘
    13. 🚫 Define a constant instead of duplicating this literal " "values": "string"\n" 3 times. 📘
    14. 🚫 Define a constant instead of duplicating this literal " }\n" 5 times. 📘
    15. 🚫 Define a constant instead of duplicating this literal "序列化失败" 13 times. 📘
    16. 🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed. 📘
    17. 🚫 Refactor this method to reduce its Cognitive Complexity from 145 to the 15 allowed. 📘
    18. 🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed. 📘
    19. 🚫 Refactor this method to reduce its Cognitive Complexity from 22 to the 15 allowed. 📘
    20. 🚫 Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed. 📘
    21. 🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.) 📘
    22. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    23. 🚫 Refactor this code to not throw exceptions in finally blocks. 📘
    24. 🚫 Change this "try" to a try-with-resources. (sonar.java.source not set. Assuming 7 or greater.) 📘
    25. 🚫 Define a constant instead of duplicating this literal "jobName" 6 times. 📘
    26. 🚫 Define a constant instead of duplicating this literal "2020-11-07 21:22:20" 6 times. 📘
    27. 🚫 Define a constant instead of duplicating this literal "2020-11-07 23:40:30" 6 times. 📘
    28. 🚫 Define a constant instead of duplicating this literal "YYYYMMDD-*** NodeId=, QueueId=, MsgId=*******************, Len=," 3 times. 📘
    29. 🚫 Define a constant instead of duplicating this literal "netaddr,telno,mobileno,faxno,hometelno,worktelno,fax,mobil,call" 6 times. 📘
    30. 🚫 Define a constant instead of duplicating this literal "email" 3 times. 📘
    • ... 162 more
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment