[ 
https://issues.apache.org/jira/browse/NIFI-7012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17024992#comment-17024992
 ] 

Dariusz Chmielewski commented on NIFI-7012:
-------------------------------------------

Thank you [~alopresto]! This patch does address the NiFi startup issue, but 
while I was testing this I did notice one side issue. If you try to change 
sensitive parameter value while InvokeScriptedProcessor using it is currently 
running you will get below exception and parameter value does not change. You 
have to manually stop the processor first to successfully change the sensitive 
parameter value.
{code:java}
2020-01-28 09:12:26,686 INFO [Parameter Context Update Thread-1] 
o.a.n.web.api.ParameterContextResource Disabling 0 Controller Services in order 
to update Parameter Context2020-01-28 09:12:26,686 INFO [Parameter Context 
Update Thread-1] o.a.n.web.api.ParameterContextResource Disabling 0 Controller 
Services in order to update Parameter Context2020-01-28 09:12:26,687 INFO 
[Parameter Context Update Thread-1] o.a.n.web.api.ParameterContextResource 
Updating Parameter Context with ID 
900a6ced-016f-1000-13a0-956c5fa9adec2020-01-28 09:12:26,687 INFO [Parameter 
Context Update Thread-1] o.a.n.web.api.ParameterContextResource Re-Enabling 0 
Controller Services after having updated Parameter Context2020-01-28 
09:12:26,687 INFO [Parameter Context Update Thread-1] 
o.a.n.web.api.ParameterContextResource Restarting 1 Processors after having 
updated Parameter Context2020-01-28 09:12:26,914 INFO [Flow Service Tasks 
Thread-2] o.a.nifi.controller.StandardFlowService Saved flow controller 
org.apache.nifi.controller.FlowController@327a1949 // Another save pending = 
false2020-01-28 09:12:27,349 INFO [Parameter Context Update Thread-1] 
o.a.n.c.s.StandardProcessScheduler Starting 
InvokeScriptedProcessor[id=90151674-016f-1000-9378-1054622ee2a1]2020-01-28 
09:12:27,349 INFO [Parameter Context Update Thread-1] 
o.a.n.controller.StandardProcessorNode Starting 
InvokeScriptedProcessor[id=90151674-016f-1000-9378-1054622ee2a1]2020-01-28 
09:12:27,562 INFO [Timer-Driven Process Thread-4] 
o.a.n.c.s.TimerDrivenSchedulingAgent Scheduled 
InvokeScriptedProcessor[id=90151674-016f-1000-9378-1054622ee2a1] to run with 1 
threads2020-01-28 09:12:27,765 INFO [Flow Service Tasks Thread-2] 
o.a.nifi.controller.StandardFlowService Saved flow controller 
org.apache.nifi.controller.FlowController@327a1949 // Another save pending = 
false2020-01-28 09:12:28,058 ERROR [Parameter Context Update Thread-1] 
o.a.n.web.api.ParameterContextResource Failed to update Parameter 
Contextjava.lang.IllegalStateException: Cannot update Parameter Context Test 
because the update would add a Sensitive Parameter named 'test_pass' but this 
Parameter already is referenced by a Non-Sensitive Property. at 
org.apache.nifi.web.dao.impl.StandardParameterContextDAO.verifyParameterUpdate(StandardParameterContextDAO.java:189)
 at 
org.apache.nifi.web.dao.impl.StandardParameterContextDAO.verifyUpdate(StandardParameterContextDAO.java:153)
 at 
org.apache.nifi.web.dao.impl.StandardParameterContextDAO$$FastClassBySpringCGLIB$$7099e091.invoke(<generated>)
 at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
 at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
 at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
 at 
org.apache.nifi.web.dao.impl.StandardParameterContextDAO$$EnhancerBySpringCGLIB$$90f1d6e7.verifyUpdate(<generated>)
 at 
org.apache.nifi.web.StandardNiFiServiceFacade.verifyUpdateParameterContext(StandardNiFiServiceFacade.java:1004)
 at 
org.apache.nifi.web.StandardNiFiServiceFacade$$FastClassBySpringCGLIB$$358780e0.invoke(<generated>)
 at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at 
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
 at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
 at 
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
 at 
org.apache.nifi.web.NiFiServiceFacadeLock.proceedWithReadLock(NiFiServiceFacadeLock.java:161)
 at 
org.apache.nifi.web.NiFiServiceFacadeLock.verifyLock(NiFiServiceFacadeLock.java:138)
 at sun.reflect.GeneratedMethodAccessor335.invoke(Unknown Source) at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498) at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
 at 
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
 at 
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
 at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at 
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
 at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
 at 
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
 at 
org.apache.nifi.web.StandardNiFiServiceFacade$$EnhancerBySpringCGLIB$$ceb8015.verifyUpdateParameterContext(<generated>)
 at 
org.apache.nifi.web.api.ParameterContextResource.performParameterContextUpdate(ParameterContextResource.java:931)
 at 
org.apache.nifi.web.api.ParameterContextResource.updateParameterContext(ParameterContextResource.java:867)
 at 
org.apache.nifi.web.api.ParameterContextResource.lambda$submitUpdateRequest$17(ParameterContextResource.java:804)
 at 
org.apache.nifi.web.api.concurrent.AsyncRequestManager$2.run(AsyncRequestManager.java:117)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at 
java.util.concurrent.FutureTask.run(FutureTask.java:266) at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
at java.lang.Thread.run(Thread.java:748){code}

> Using sensitive parameter in sensitive property of InvokeScriptedProcessor 
> causes Jetty shutdown on NiFi restart
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-7012
>                 URL: https://issues.apache.org/jira/browse/NIFI-7012
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.10.0
>         Environment: OpenJDK 1.8.0_232 on Ubuntu 18.04.3 LTS
>            Reporter: Dariusz Chmielewski
>            Assignee: Andy LoPresto
>            Priority: Major
>              Labels: parameters, scripting, security
>         Attachments: groovy_sample.txt
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> To simulate this add a new InvokeScriptedProcessor to your flow with attached 
> example basic Groovy script as the Script Body. This will create a "Password" 
> sensitive property on the processor, then using UI enter sensitive parameter 
> (ex: "#\{test_pass}") in the value of this property. At this point everything 
> will work fine, no errors in UI or nifi-app.log during this processor 
> execution, but when you restart NiFi you will notice the below warning in 
> nifi-app.log. To get around this issue and have Jetty start again I had to 
> manually edit flow.xml and set the parameter ("test_pass") sensitive value to 
> false. Note that both the processor property and parameter appear as 
> sensitive in UI (before making changes to flow.xml) and their values are 
> encrypted in flow.xml.
> {code:java}
> 2020-01-10 15:37:28,492 INFO [main] org.eclipse.jetty.server.Server Started 
> @29687ms
>  2020-01-10 15:37:28,493 WARN [main] org.apache.nifi.web.server.JettyServer 
> Failed to start web server... shutting down.
>  org.apache.nifi.controller.serialization.FlowSynchronizationException: 
> java.lang.IllegalArgumentException: The property 'Password' cannot reference 
> Parameter 'test_pass' because Sensitive Parameters may only be referenced by 
> Sensitive Properties.
>  at 
> org.apache.nifi.controller.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:510)
>  at 
> org.apache.nifi.controller.FlowController.synchronize(FlowController.java:1368)
>  at 
> org.apache.nifi.persistence.StandardXMLFlowConfigurationDAO.load(StandardXMLFlowConfigurationDAO.java:88)
>  at 
> org.apache.nifi.controller.StandardFlowService.loadFromBytes(StandardFlowService.java:812)
>  at 
> org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:557)
>  at 
> org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:72)
>  at 
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:959)
>  at 
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
>  at 
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:924)
>  at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
>  at 
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
>  at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
>  at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:854)
>  at 
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
>  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
>  at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
>  at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>  at 
> org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:406)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
>  at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119)
>  at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167)
>  at org.eclipse.jetty.server.Server.start(Server.java:418)
>  at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
>  at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>  at org.eclipse.jetty.server.Server.doStart(Server.java:382)
>  at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>  at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:952)
>  at org.apache.nifi.NiFi.<init>(NiFi.java:158)
>  at org.apache.nifi.NiFi.<init>(NiFi.java:72)
>  at org.apache.nifi.NiFi.main(NiFi.java:301)
>  Caused by: java.lang.IllegalArgumentException: The property 'Password' 
> cannot reference Parameter 'test_pass' because Sensitive Parameters may only 
> be referenced by Sensitive Properties.
>  at 
> org.apache.nifi.controller.AbstractComponentNode.verifyCanUpdateProperties(AbstractComponentNode.java:307)
>  at 
> org.apache.nifi.controller.AbstractComponentNode.setProperties(AbstractComponentNode.java:192)
>  at 
> org.apache.nifi.controller.ComponentNode.setProperties(ComponentNode.java:60)
>  at 
> org.apache.nifi.controller.StandardFlowSynchronizer.updateProcessor(StandardFlowSynchronizer.java:1227)
>  at 
> org.apache.nifi.controller.StandardFlowSynchronizer.addProcessGroup(StandardFlowSynchronizer.java:1334)
>  at 
> org.apache.nifi.controller.StandardFlowSynchronizer.addProcessGroup(StandardFlowSynchronizer.java:1458)
>  at 
> org.apache.nifi.controller.StandardFlowSynchronizer.sync(StandardFlowSynchronizer.java:393)
>  ... 42 common frames omitted
>  2020-01-10 15:37:28,494 INFO [Thread-1] org.apache.nifi.NiFi Initiating 
> shutdown of Jetty web server...{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to