You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "slambrose (via GitHub)" <gi...@apache.org> on 2023/02/28 15:31:37 UTC

[GitHub] [nifi] slambrose opened a new pull request, #6993: NIFI-11231 Stateless NiFi secure parameter context support

slambrose opened a new pull request, #6993:
URL: https://github.com/apache/nifi/pull/6993

   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-11231](https://issues.apache.org/jira/browse/NIFI-11231)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [X] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI-11231) issue created
   
   ### Pull Request Tracking
   
   - [X] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [X] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [X ] Pull Request based on current revision of the `main` branch
   - [X ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [X] Build completed using `mvn clean install -P contrib-check`
     - [X] JDK 11
     - [X] JDK 17
   
   ### Licensing
   
   - [X] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html) - N/A
   - [X] New dependencies are documented in applicable `LICENSE` and `NOTICE` files - N/A
   
   ### Documentation
   
   - [X] Documentation formatting appears as expected in rendered files
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] gresockj commented on pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "gresockj (via GitHub)" <gi...@apache.org>.
gresockj commented on PR #6993:
URL: https://github.com/apache/nifi/pull/6993#issuecomment-1460864476

   
   > Hmm.. I'm not sure Parameter Value Provider would work for us since these have to be passed in on runtime and known beforehand. We're going to be supporting a variety of flows stored in Registry. The goal is to run stateless NiFi with any given Registry url, bucket id, flow id, and flow version without any knowledge of what properties/params users have configured in their flows. So those flows that utilize sensitive parameter contexts need to be able to work under any running statless nifi pod/container. We wouldn't be changing the run command or properties files for each flow that's processed with stateless NiFi. Let me chat some more with @Dye357 to see if there's anything I'm missing.
   
   Hi @slambrose, what you describe should be possible with the existing EnvironmentVariableParameterValueProvider.  Let me know if you have any other questions about the setup.
   
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] slambrose commented on a diff in pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "slambrose (via GitHub)" <gi...@apache.org>.
slambrose commented on code in PR #6993:
URL: https://github.com/apache/nifi/pull/6993#discussion_r1128479495


##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -270,10 +271,9 @@ public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceSt
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
                                                  final boolean register, final String classloaderIsolationKey) {
 
-        if (type == null || id == null || bundleCoordinate == null) {

Review Comment:
   Valid point. I used this implementation because it was cleaner as well. The requireNonNull throws a generic NullPointerException, but doesn't have the full details like the current code:
   throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id + ", bundle coordinate = " + bundleCoordinate);
                   
   I can change this back if desired, just let me know.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #6993:
URL: https://github.com/apache/nifi/pull/6993#discussion_r1128484719


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/ParameterContextTaskLogObserver.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.logging;
+
+import org.apache.nifi.controller.ParameterProviderNode;
+import org.apache.nifi.events.BulletinFactory;
+import org.apache.nifi.reporting.Bulletin;
+import org.apache.nifi.reporting.BulletinRepository;
+import org.apache.nifi.reporting.ComponentType;
+import org.apache.nifi.reporting.Severity;
+
+public class ParameterContextTaskLogObserver implements LogObserver {
+    private final BulletinRepository bulletinRepository;
+    private final ParameterProviderNode taskNode;

Review Comment:
   This should be named `providerNode` instead of `taskNode` to align with the element being observed.
   ```suggestion
       private final ParameterProviderNode providerNode;
   ```



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/ParameterContextTaskLogObserver.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.logging;
+
+import org.apache.nifi.controller.ParameterProviderNode;
+import org.apache.nifi.events.BulletinFactory;
+import org.apache.nifi.reporting.Bulletin;
+import org.apache.nifi.reporting.BulletinRepository;
+import org.apache.nifi.reporting.ComponentType;
+import org.apache.nifi.reporting.Severity;
+
+public class ParameterContextTaskLogObserver implements LogObserver {
+    private final BulletinRepository bulletinRepository;
+    private final ParameterProviderNode taskNode;
+
+    public ParameterContextTaskLogObserver(final BulletinRepository bulletinRepository, final ParameterProviderNode taskNode) {
+        this.bulletinRepository = bulletinRepository;
+        this.taskNode = taskNode;
+    }
+
+    @Override
+    public void onLogMessage(final LogMessage message) {
+        // Map LogLevel.WARN to Severity.WARNING so that we are consistent with the Severity enumeration. Else, just use whatever
+        // the LogLevel is (INFO and ERROR map directly and all others we will just accept as they are).
+        final String bulletinLevel = message.getLogLevel() == LogLevel.WARN ? Severity.WARNING.name() : message.getLogLevel().toString();
+
+        final Bulletin bulletin = BulletinFactory.createBulletin(null, taskNode.getIdentifier(), ComponentType.REPORTING_TASK,

Review Comment:
   The `ComponentType` should be `PARAMETER_PROVIDER` instead of `REPORTING_TASK`:
   ```suggestion
           final Bulletin bulletin = BulletinFactory.createBulletin(null, taskNode.getIdentifier(), ComponentType.PARAMETER_PROVIDER,
   ```



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/ParameterContextTaskLogObserver.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.logging;
+
+import org.apache.nifi.controller.ParameterProviderNode;
+import org.apache.nifi.events.BulletinFactory;
+import org.apache.nifi.reporting.Bulletin;
+import org.apache.nifi.reporting.BulletinRepository;
+import org.apache.nifi.reporting.ComponentType;
+import org.apache.nifi.reporting.Severity;
+
+public class ParameterContextTaskLogObserver implements LogObserver {
+    private final BulletinRepository bulletinRepository;
+    private final ParameterProviderNode taskNode;
+
+    public ParameterContextTaskLogObserver(final BulletinRepository bulletinRepository, final ParameterProviderNode taskNode) {

Review Comment:
   As above, `taskNode` should be renamed to `providerNode`:
   ```suggestion
       public ParameterContextTaskLogObserver(final BulletinRepository bulletinRepository, final ParameterProviderNode providerNode) {
   ```



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +320,54 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        requireNonNull(type);
+        requireNonNull(id);
+        requireNonNull(bundleCoordinate);

Review Comment:
   The `requireNonNull` method takes a message, so recommend adding a message for each of these lines to clarify the problem.
   ```suggestion
           requireNonNull(type, "Provider Type required");
           requireNonNull(id, "Provider ID required");
           requireNonNull(bundleCoordinate, "Provider Bundle Coordinate required");
   ```



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id
+                + ", bundle coordinate = " + bundleCoordinate);
+        }
+
+        // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
+        final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
+
+        final ParameterProviderNode taskNode;
+        try {
+            taskNode = new ComponentBuilder()
+                    .identifier(id)
+                    .type(type)
+                    .bundleCoordinate(bundleCoordinate)
+                    .statelessEngine(statelessEngine)
+                    .additionalClassPathUrls(additionalUrls)
+                    .flowManager(this)
+                    .buildParameterProvider();
+        } catch (ParameterProviderInstantiationException e) {
+            throw new RuntimeException("Could not create Parameter Context Task of type " + type + " with ID " + id, e);

Review Comment:
   Following the pattern of other methods, this should throw an `IllegalStateException` instead of the more generic `RuntimeException`.



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id

Review Comment:
   The wording should be changed to indicate `Parameter provider` instead of `Reporting Task`:
   ```suggestion
               throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Parameter Provider. Provided arguments were type=" + type + ", id=" + id
   ```



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id
+                + ", bundle coordinate = " + bundleCoordinate);
+        }
+
+        // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
+        final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
+
+        final ParameterProviderNode taskNode;

Review Comment:
   The variable name should be changed to `providerNode` instead of `taskNode` to follow the naming convention of the class.
   ```suggestion
           final ParameterProviderNode providerNode;
   ```



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id
+                + ", bundle coordinate = " + bundleCoordinate);
+        }
+
+        // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
+        final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
+
+        final ParameterProviderNode taskNode;
+        try {
+            taskNode = new ComponentBuilder()
+                    .identifier(id)
+                    .type(type)
+                    .bundleCoordinate(bundleCoordinate)
+                    .statelessEngine(statelessEngine)
+                    .additionalClassPathUrls(additionalUrls)
+                    .flowManager(this)
+                    .buildParameterProvider();
+        } catch (ParameterProviderInstantiationException e) {
+            throw new RuntimeException("Could not create Parameter Context Task of type " + type + " with ID " + id, e);
+        }
 
-        throw new UnsupportedOperationException("Parameter Providers are not supported in Stateless NiFi");
+        LogRepositoryFactory.getRepository(taskNode.getIdentifier()).setLogger(taskNode.getLogger());
+
+        if (firstTimeAdded) {
+            final Class<?> taskClass = taskNode.getParameterProvider().getClass();

Review Comment:
   ```suggestion
               final Class<?> providerClass = taskNode.getParameterProvider().getClass();
   ```



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id
+                + ", bundle coordinate = " + bundleCoordinate);
+        }
+
+        // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
+        final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
+
+        final ParameterProviderNode taskNode;
+        try {
+            taskNode = new ComponentBuilder()
+                    .identifier(id)
+                    .type(type)
+                    .bundleCoordinate(bundleCoordinate)
+                    .statelessEngine(statelessEngine)
+                    .additionalClassPathUrls(additionalUrls)
+                    .flowManager(this)
+                    .buildParameterProvider();
+        } catch (ParameterProviderInstantiationException e) {
+            throw new RuntimeException("Could not create Parameter Context Task of type " + type + " with ID " + id, e);
+        }
 
-        throw new UnsupportedOperationException("Parameter Providers are not supported in Stateless NiFi");
+        LogRepositoryFactory.getRepository(taskNode.getIdentifier()).setLogger(taskNode.getLogger());
+
+        if (firstTimeAdded) {
+            final Class<?> taskClass = taskNode.getParameterProvider().getClass();
+            final String identifier = taskNode.getParameterProvider().getIdentifier();
+
+            try (final NarCloseable x = NarCloseable.withComponentNarLoader(statelessEngine.getExtensionManager(), taskClass, identifier)) {
+                ReflectionUtils.invokeMethodsWithAnnotation(OnAdded.class, taskNode.getParameterProvider());
+
+                if (isFlowInitialized()) {
+                    ReflectionUtils.quietlyInvokeMethodsWithAnnotation(OnConfigurationRestored.class, taskNode.getParameterProvider(), taskNode.getConfigurationContext());
+                }
+            } catch (final Exception e) {
+                throw new ComponentLifeCycleException("Failed to invoke On-Added Lifecycle methods of " + taskNode.getParameterProvider(), e);
+            }
+        }
+
+        if (registerLogObserver) {
+            onParameterProviderAdded(taskNode);
+
+            // Register log observer to provide bulletins when reporting task logs anything at WARN level or above

Review Comment:
   This comment appears to be copied from Reporting Tasks, so it should be updated or removed.



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -270,10 +271,9 @@ public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceSt
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
                                                  final boolean register, final String classloaderIsolationKey) {
 
-        if (type == null || id == null || bundleCoordinate == null) {

Review Comment:
   Concurring with @joewitt, the previous implementation provides a much clearer error message than `requireNonNull`. Recommend reverting this change.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/ParameterContextTaskLogObserver.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.logging;
+
+import org.apache.nifi.controller.ParameterProviderNode;
+import org.apache.nifi.events.BulletinFactory;
+import org.apache.nifi.reporting.Bulletin;
+import org.apache.nifi.reporting.BulletinRepository;
+import org.apache.nifi.reporting.ComponentType;
+import org.apache.nifi.reporting.Severity;
+
+public class ParameterContextTaskLogObserver implements LogObserver {

Review Comment:
   This should be renamed to `ParameterProviderLogObserver` to reflect the type of object being observed.
   ```suggestion
   public class ParameterProviderLogObserver implements LogObserver {
   ```
   



##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -320,9 +321,55 @@ public ReportingTaskNode createReportingTask(final String type, final String id,
 
     @Override
     public ParameterProviderNode createParameterProvider(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
-                                                         final boolean register) {
+                                                         final boolean registerLogObserver) {
+        if (type == null || id == null || bundleCoordinate == null) {
+            throw new NullPointerException("Must supply type, id, and bundle coordinate in order to create Reporting Task. Provided arguments were type=" + type + ", id=" + id
+                + ", bundle coordinate = " + bundleCoordinate);
+        }
+
+        // make sure the first reference to LogRepository happens outside of a NarCloseable so that we use the framework's ClassLoader
+        final LogRepository logRepository = LogRepositoryFactory.getRepository(id);
+
+        final ParameterProviderNode taskNode;
+        try {
+            taskNode = new ComponentBuilder()
+                    .identifier(id)
+                    .type(type)
+                    .bundleCoordinate(bundleCoordinate)
+                    .statelessEngine(statelessEngine)
+                    .additionalClassPathUrls(additionalUrls)
+                    .flowManager(this)
+                    .buildParameterProvider();
+        } catch (ParameterProviderInstantiationException e) {
+            throw new RuntimeException("Could not create Parameter Context Task of type " + type + " with ID " + id, e);

Review Comment:
   The wording should reference `Parameter Provider` instead of `Parameter Context`:
   ```suggestion
               throw new RuntimeException("Could not create Parameter Provider of type " + type + " with ID " + id, e);
   ```



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] slambrose commented on a diff in pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "slambrose (via GitHub)" <gi...@apache.org>.
slambrose commented on code in PR #6993:
URL: https://github.com/apache/nifi/pull/6993#discussion_r1128489702


##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -270,10 +271,9 @@ public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceSt
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
                                                  final boolean register, final String classloaderIsolationKey) {
 
-        if (type == null || id == null || bundleCoordinate == null) {

Review Comment:
   Done :)



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] exceptionfactory closed pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory closed pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support
URL: https://github.com/apache/nifi/pull/6993


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] exceptionfactory commented on pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #6993:
URL: https://github.com/apache/nifi/pull/6993#issuecomment-1460246061

   > Use case: We are attempting to use stateless NiFi in k8s to process data while providing a horizontally scaled approach. Some of our users' flows are using sensitive parameters, so we have to be able to support this in our implementation. @Dye357 is the project lead for the effort, and can give a more robust explanation if needed. I tested this with an SFTP processor using the secure environment variable parameter context, which worked successfully.
   
   Thanks for addressing the code comments and providing some background on the use case @slambrose, that is helpful.
   
   Have you or @Dye357 reviewed the [Parameter Value Provider](https://github.com/apache/nifi/tree/main/nifi-stateless/nifi-stateless-assembly#passing-parameters) implementations for NiFi Stateless? The Parameter Value Providers support the use case of supplying sensitive parameter values, which should make the proposed changes unnecessary. If there is some feature gap in the Parameter Value Providers, we should evaluate that for improvement, as opposed to introducing Parameter Providers, intended for traditional NiFi deployments.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] joewitt commented on a diff in pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "joewitt (via GitHub)" <gi...@apache.org>.
joewitt commented on code in PR #6993:
URL: https://github.com/apache/nifi/pull/6993#discussion_r1128464815


##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -270,10 +271,9 @@ public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceSt
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
                                                  final boolean register, final String classloaderIsolationKey) {
 
-        if (type == null || id == null || bundleCoordinate == null) {

Review Comment:
   With this removal will the log/exception information still be as specific as it was?  The code is clearly cleaner but we go backwards in communicating intent.  Am i reading that right?



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] joewitt commented on a diff in pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "joewitt (via GitHub)" <gi...@apache.org>.
joewitt commented on code in PR #6993:
URL: https://github.com/apache/nifi/pull/6993#discussion_r1128484574


##########
nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StatelessFlowManager.java:
##########
@@ -270,10 +271,9 @@ public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceSt
     public ReportingTaskNode createReportingTask(final String type, final String id, final BundleCoordinate bundleCoordinate, final Set<URL> additionalUrls, final boolean firstTimeAdded,
                                                  final boolean register, final String classloaderIsolationKey) {
 
-        if (type == null || id == null || bundleCoordinate == null) {

Review Comment:
   Yeah I'd not change this since while the code is cleaner it is also far less effective in conveying intent to the user.  Ultimately that is our desire given this block of code.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] slambrose commented on pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "slambrose (via GitHub)" <gi...@apache.org>.
slambrose commented on PR #6993:
URL: https://github.com/apache/nifi/pull/6993#issuecomment-1460261250

   > > Use case: We are attempting to use stateless NiFi in k8s to process data while providing a horizontally scaled approach. Some of our users' flows are using sensitive parameters, so we have to be able to support this in our implementation. @Dye357 is the project lead for the effort, and can give a more robust explanation if needed. I tested this with an SFTP processor using the secure environment variable parameter context, which worked successfully.
   > 
   > Thanks for addressing the code comments and providing some background on the use case @slambrose, that is helpful.
   > 
   > Have you or @Dye357 reviewed the [Parameter Value Provider](https://github.com/apache/nifi/tree/main/nifi-stateless/nifi-stateless-assembly#passing-parameters) implementations for NiFi Stateless? The Parameter Value Providers support the use case of supplying sensitive parameter values, which should make the proposed changes unnecessary. If there is some feature gap in the Parameter Value Providers, we should evaluate that for improvement, as opposed to introducing Parameter Providers, intended for traditional NiFi deployments.
   
   Hmm.. I'm not sure Parameter Value Provider would work for us since these have to be passed in on runtime and known beforehand. We're going to be supporting a variety of flows stored in Registry. The goal is to run stateless NiFi with any given Registry url, bucket id, flow id, and flow version without any knowledge of what properties/params users have configured in their flows. So those flows that utilize sensitive parameter contexts need to be able to work under any running statless nifi pod/container. We wouldn't be changing the run command or properties files for each flow that's processed with stateless NiFi. Let me chat some more with @Dye357 to see if there's anything I'm missing.


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] slambrose commented on pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "slambrose (via GitHub)" <gi...@apache.org>.
slambrose commented on PR #6993:
URL: https://github.com/apache/nifi/pull/6993#issuecomment-1460134990

   Use case:
   We are attempting to use stateless NiFi in k8s to process data while providing a horizontally scaled approach. Some of our users' flows are using sensitive parameters, so we have to be able to support this in our implementation. @Dye357 is the project lead for the effort, and can give a more robust explanation if needed. I tested this with an SFTP processor using the secure environment variable parameter context, which worked successfully. 


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi] exceptionfactory commented on pull request #6993: NIFI-11231 Stateless NiFi sensitive parameter context support

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #6993:
URL: https://github.com/apache/nifi/pull/6993#issuecomment-1466958447

   Closing based on discussion of recommend alternatives. If there are any additional questions on the current implementation, the discussion can be continued under the linked Jira issue: [NIFI-11231](https://issues.apache.org/jira/browse/NIFI-11231)


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org