exceptionfactory commented on code in PR #6367:
URL: https://github.com/apache/nifi/pull/6367#discussion_r964284917


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java:
##########
@@ -419,21 +422,27 @@ public void onTrigger(ProcessContext context, final 
ProcessSession session) thro
                 }
                 return 0;
             });
-            for ( final PropertyDescriptor descriptor : propertyDescriptors) {
+
+            for (final PropertyDescriptor descriptor : propertyDescriptors) {
+                if (descriptor.isSensitive()) {
+                    String maskedValue = IntStream.rangeClosed(0, 
MASKED_VALUE_LENGTH).mapToObj(i -> "*").collect(Collectors.joining());
+                    argumentAttributeValue.add(maskedValue);
+                } else {
+                    
argumentAttributeValue.add(context.getProperty(descriptor.getName()).evaluateAttributeExpressions(inputFlowFile).getValue());
+                }
                 
args.add(context.getProperty(descriptor.getName()).evaluateAttributeExpressions(inputFlowFile).getValue());

Review Comment:
   The evaluated value of `context.getProperty(...)` should be extracted to a 
variable and reused.



##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java:
##########
@@ -419,21 +422,27 @@ public void onTrigger(ProcessContext context, final 
ProcessSession session) thro
                 }
                 return 0;
             });
-            for ( final PropertyDescriptor descriptor : propertyDescriptors) {
+
+            for (final PropertyDescriptor descriptor : propertyDescriptors) {
+                if (descriptor.isSensitive()) {
+                    String maskedValue = IntStream.rangeClosed(0, 
MASKED_VALUE_LENGTH).mapToObj(i -> "*").collect(Collectors.joining());
+                    argumentAttributeValue.add(maskedValue);

Review Comment:
   Instead of the `IntStream` approach, this should be replaced with a static 
variable named something like `MASKED_ARGUMENT` with a value of `********`. 
That would allow simplifying this as follows:
   
   ```suggestion
                       argumentAttributeValue.add(MASKED_ARGUMENT);
   ```



-- 
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]

Reply via email to