mirror of https://github.com/apache/nifi.git
NIFI-4920 Skipping sensitive properties when updating component properties from versioned component. This closes #2505.
Signed-off-by: Mark Payne <markap14@hotmail.com>
This commit is contained in:
parent
74bb341abc
commit
179e967b47
|
@ -4098,9 +4098,17 @@ public final class StandardProcessGroup implements ProcessGroup {
|
||||||
private Map<String, String> populatePropertiesMap(final Map<PropertyDescriptor, String> currentProperties, final Map<String, String> proposedProperties,
|
private Map<String, String> populatePropertiesMap(final Map<PropertyDescriptor, String> currentProperties, final Map<String, String> proposedProperties,
|
||||||
final Map<String, VersionedPropertyDescriptor> proposedDescriptors, final ProcessGroup group) {
|
final Map<String, VersionedPropertyDescriptor> proposedDescriptors, final ProcessGroup group) {
|
||||||
|
|
||||||
|
// since VersionedPropertyDescriptor currently doesn't know if it is sensitive or not,
|
||||||
|
// keep track of which property descriptors are sensitive from the current properties
|
||||||
|
final Set<String> sensitiveProperties = new HashSet<>();
|
||||||
|
|
||||||
final Map<String, String> fullPropertyMap = new HashMap<>();
|
final Map<String, String> fullPropertyMap = new HashMap<>();
|
||||||
for (final PropertyDescriptor property : currentProperties.keySet()) {
|
for (final PropertyDescriptor property : currentProperties.keySet()) {
|
||||||
fullPropertyMap.put(property.getName(), null);
|
if (property.isSensitive()) {
|
||||||
|
sensitiveProperties.add(property.getName());
|
||||||
|
} else {
|
||||||
|
fullPropertyMap.put(property.getName(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proposedProperties != null) {
|
if (proposedProperties != null) {
|
||||||
|
@ -4108,6 +4116,11 @@ public final class StandardProcessGroup implements ProcessGroup {
|
||||||
final String propertyName = entry.getKey();
|
final String propertyName = entry.getKey();
|
||||||
final VersionedPropertyDescriptor descriptor = proposedDescriptors.get(propertyName);
|
final VersionedPropertyDescriptor descriptor = proposedDescriptors.get(propertyName);
|
||||||
|
|
||||||
|
// skip any sensitive properties so we can retain whatever is currently set
|
||||||
|
if (sensitiveProperties.contains(propertyName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String value;
|
String value;
|
||||||
if (descriptor != null && descriptor.getIdentifiesControllerService()) {
|
if (descriptor != null && descriptor.getIdentifiesControllerService()) {
|
||||||
// Property identifies a Controller Service. So the value that we want to assign is not the value given.
|
// Property identifies a Controller Service. So the value that we want to assign is not the value given.
|
||||||
|
|
Loading…
Reference in New Issue