cryptoe commented on code in PR #13231:
URL: https://github.com/apache/druid/pull/13231#discussion_r998891461
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQTaskQueryMaker.java:
##########
@@ -282,6 +299,23 @@ private static Map<String, ColumnType>
buildAggregationIntermediateTypeMap(final
return retVal;
}
+ @VisibleForTesting
+ static String maskSensitiveJsonKeys(String taskJson)
Review Comment:
Lets add a new util class for this method in `org.apache.sql.msq.util`, make
it public, and then it should be easy enough to test as well.
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQTaskQueryMaker.java:
##########
@@ -282,6 +299,23 @@ private static Map<String, ColumnType>
buildAggregationIntermediateTypeMap(final
return retVal;
}
+ @VisibleForTesting
+ static String maskSensitiveJsonKeys(String taskJson)
+ {
+ StringBuilder maskedJson = new StringBuilder(taskJson);
+ for (Pattern p : SENSITIVE_KEYS_REGEX_PATTERNS) {
+ Matcher m = p.matcher(taskJson);
+ while (m.find()) {
+ String sensitiveData = m.group("sensitive");
+ int start = maskedJson.indexOf(sensitiveData);
+ int end = start + sensitiveData.length();
+ maskedJson.replace(start, end, "<masked>");
+ }
+ }
+ return maskedJson.toString();
Review Comment:
might have to rename this variable as well.
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQTaskQueryMaker.java:
##########
@@ -282,6 +299,23 @@ private static Map<String, ColumnType>
buildAggregationIntermediateTypeMap(final
return retVal;
}
+ @VisibleForTesting
+ static String maskSensitiveJsonKeys(String taskJson)
+ {
+ StringBuilder maskedJson = new StringBuilder(taskJson);
Review Comment:
Why is the input a json. Shouldn't it be any string ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]