Open wbeckler opened 1 year ago
thanks @wbeckler . Hello team - appreciate any help on the issue. We will also test on latest 2.8 release and confirm if this still continues to be a bug.
@wbeckler @ravikiranvuppu Is the issue still there if you call the get alerts api? I believe this issue should be fixed in 2.7 with this PR
Hi @lezzago .. looks like get alerts api works fine. however that exception and error is still thrown if you set "plugins.alerting.filter_by_backend_roles" : "true" . This seems to be same behavior with 2.5 up till 2.8 latest release.
but as you said it does look like it's throwing this error when you click on monitor or alerts ui and is trying to get / load the related alerts.
Hello @lezzago @wbeckler - wondering if you have had any luck with bug above ? This is preventing us from using the feature and extending this to product teams .. is there a solution that we could try ?
Hi @lezzago - any chance that this bug could get addressed in upcoming 2.9 release ?
Hi @lezzago I am also facing same problem when we enable "plugins.alerting.filter_by_backend_roles": "true" Please check the debug logs these might help.
2023-07-10T11:52:37,023][DEBUG][o.o.a.t.SecureTransportAction] [opensearch-cluster_manager] User and roles string from thread context: survival|alerting_full_access_tenant|own_index,alerting_full_access_tenant|survival_demo [2023-07-10T11:52:37,024][DEBUG][o.o.a.t.SecureTransportAction] [opensearch-cluster_manager] User and roles string from thread context: null
2023-07-10T11:52:37,023][DEBUG][o.o.a.t.SecureTransportAction] [opensearch-cluster_manager] User and roles string from thread context: survival|alerting_full_access_tenant|own_index,alerting_full_access_tenant|survival_demo
[2023-07-10T11:52:37,024][DEBUG][o.o.a.t.SecureTransportAction] [opensearch-cluster_manager] User and roles string from thread context: null
[2023-07-10T11:52:37,024][ERROR][o.o.a.u.AlertingException] [opensearch-cluster_manager] Alerting error: OpenSearchStatusException[Filter by user backend roles is enabled with security disabled.]
[2023-07-10T11:52:37,024][ERROR][o.o.a.t.TransportGetAlertsAction] [opensearch-cluster_manager] Failed to get alerts
org.opensearch.alerting.util.AlertingException: Filter by user backend roles is enabled with security disabled.
at org.opensearch.alerting.util.AlertingException$Companion.wrap(AlertingException.kt:70) ~[?:?]
at org.opensearch.alerting.transport.SecureTransportAction$DefaultImpls.validateUserBackendRoles(SecureTransportAction.kt:82) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.validateUserBackendRoles(TransportGetMonitorAction.kt:36) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:64) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:36) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:218) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.indexmanagement.rollup.actionfilter.FieldCapsFilter.apply(FieldCapsFilter.kt:118) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.security.filter.SecurityFilter.apply0(SecurityFilter.java:264) ~[?:?]
at org.opensearch.security.filter.SecurityFilter.apply(SecurityFilter.java:149) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter.apply(PerformanceAnalyzerActionFilter.java:78) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.action.support.TransportAction.execute(TransportAction.java:188) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.action.support.TransportAction.execute(TransportAction.java:107) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:110) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:97) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:472) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2$getMonitorResponse$1.invoke(TransportGetAlertsAction.kt:170) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2$getMonitorResponse$1.invoke(TransportGetAlertsAction.kt:169) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.opensearchapi.OpenSearchExtensionsKt.suspendUntil(OpenSearchExtensions.kt:152) ~[alerting-core-2.7.0.0.jar:?]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invokeSuspend(TransportGetAlertsAction.kt:169) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invoke(TransportGetAlertsAction.kt) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invoke(TransportGetAlertsAction.kt) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:146) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at org.opensearch.alerting.transport.TransportGetAlertsAction.resolveAlertsIndexName(TransportGetAlertsAction.kt:161) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$doExecute$1$1.invokeSuspend(TransportGetAlertsAction.kt:137) [opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.6.10.jar:1.6.10-release-923(1.6.10)]
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]
Caused by: java.lang.Exception: org.opensearch.OpenSearchStatusException: Filter by user backend roles is enabled with security disabled.
... 34 more
[2023-07-10T11:52:37,026][DEBUG][r.suppressed ] [opensearch-cluster_manager] path: /_plugins/_alerting/monitors/alerts, params: {severityLevel=ALL, sortString=start_time, startIndex=0, searchString=, monitorId=u7WQP4kBKP5QTD2qlAZp, size=800, sortOrder=asc, alertState=ALL}
org.opensearch.alerting.util.AlertingException: Filter by user backend roles is enabled with security disabled.
at org.opensearch.alerting.util.AlertingException$Companion.wrap(AlertingException.kt:70) ~[?:?]
at org.opensearch.alerting.transport.SecureTransportAction$DefaultImpls.validateUserBackendRoles(SecureTransportAction.kt:82) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.validateUserBackendRoles(TransportGetMonitorAction.kt:36) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:64) ~[?:?]
at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:36) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:218) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.indexmanagement.rollup.actionfilter.FieldCapsFilter.apply(FieldCapsFilter.kt:118) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.security.filter.SecurityFilter.apply0(SecurityFilter.java:264) ~[?:?]
at org.opensearch.security.filter.SecurityFilter.apply(SecurityFilter.java:149) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter.apply(PerformanceAnalyzerActionFilter.java:78) ~[?:?]
at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.action.support.TransportAction.execute(TransportAction.java:188) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.action.support.TransportAction.execute(TransportAction.java:107) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:110) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:97) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:472) ~[opensearch-2.7.0.jar:2.7.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2$getMonitorResponse$1.invoke(TransportGetAlertsAction.kt:170) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2$getMonitorResponse$1.invoke(TransportGetAlertsAction.kt:169) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.opensearchapi.OpenSearchExtensionsKt.suspendUntil(OpenSearchExtensions.kt:152) ~[alerting-core-2.7.0.0.jar:?]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invokeSuspend(TransportGetAlertsAction.kt:169) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invoke(TransportGetAlertsAction.kt) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$resolveAlertsIndexName$2.invoke(TransportGetAlertsAction.kt) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:91) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:146) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source) ~[kotlinx-coroutines-core-1.1.1.jar:?]
at org.opensearch.alerting.transport.TransportGetAlertsAction.resolveAlertsIndexName(TransportGetAlertsAction.kt:161) ~[opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at org.opensearch.alerting.transport.TransportGetAlertsAction$doExecute$1$1.invokeSuspend(TransportGetAlertsAction.kt:137) [opensearch-alerting-2.7.0.0.jar:2.7.0.0]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.6.10.jar:1.6.10-release-923(1.6.10)]
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]
Caused by: java.lang.Exception: org.opensearch.OpenSearchStatusException: Filter by user backend roles is enabled with security disabled.
... 34 more
@techrna Thanks for those logs. Interesting to see the users and roles string from the thread context is null. The thread context must be getting reset.
Seems like the issue is caused by this line of code.
This is due to the context being stashed and its calling another transport call that sees there is no thread context, which causes the error.
I have a PR to fix this issue. This fix should be in the 2.9 release.
thank you @lezzago . Will look forward for 2.9 release with fix.
Did this fix make the 2.9 release? I'm still experiencing the issue described above. Thank you.
Yes this fix made it in the 2.9 release. Can you share the stack trace of the error from your logs?
Thank you for the prompt response. I hope this is whatyou are asking for. If not please let me know.
[edited] to include the alerting exception. I had pasted the wrong block originally.
`org.opensearch.alerting.util.AlertingException: Filter by user backend roles is enabled with security disabled. at org.opensearch.alerting.util.AlertingException$Companion.wrap(AlertingException.kt:70) ~[?:?] at org.opensearch.alerting.transport.SecureTransportAction$DefaultImpls.validateUserBackendRoles(SecureTransportAction.kt:82) ~[?:?] at org.opensearch.alerting.transport.TransportIndexMonitorAction.validateUserBackendRoles(TransportIndexMonitorAction.kt:88) ~[?:?] at org.opensearch.alerting.transport.TransportIndexMonitorAction.doExecute(TransportIndexMonitorAction.kt:135) ~[?:?] at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:218) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.indexmanagement.rollup.actionfilter.FieldCapsFilter.apply(FieldCapsFilter.kt:118) ~[?:?] at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.indexmanagement.controlcenter.notification.filter.IndexOperationActionFilter.apply(IndexOperationActionFilter.kt:39) ~[?:?] at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter.apply(PerformanceAnalyzerActionFilter.java:78) ~[?:?] at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.security.filter.SecurityFilter.apply0(SecurityFilter.java:320) ~[?:?] at org.opensearch.security.filter.SecurityFilter.apply(SecurityFilter.java:165) ~[?:?] at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:216) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.support.TransportAction.execute(TransportAction.java:188) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.support.TransportAction.execute(TransportAction.java:107) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:110) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:97) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:476) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.commons.alerting.AlertingPluginInterface.indexMonitor(AlertingPluginInterface.kt:55) ~[?:?] at org.opensearch.securityanalytics.transport.TransportIndexDetectorAction.createMonitorFromQueries(TransportIndexDetectorAction.java:302) ~[?:?] at org.opensearch.securityanalytics.transport.TransportIndexDetectorAction$AsyncIndexDetectorsAction$10.onResponse(TransportIndexDetectorAction.java:1203) ~[?:?] at org.opensearch.securityanalytics.transport.TransportIndexDetectorAction$AsyncIndexDetectorsAction$10.onResponse(TransportIndexDetectorAction.java:1180) ~[?:?] at org.opensearch.action.support.TransportAction$1.onResponse(TransportAction.java:113) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.support.TransportAction$1.onResponse(TransportAction.java:107) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionListener.onResponse(PerformanceAnalyzerActionListener.java:55) ~[?:?] at org.opensearch.action.search.TransportSearchAction.lambda$executeRequest$0(TransportSearchAction.java:398) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.ActionListener$1.onResponse(ActionListener.java:80) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.ActionListener$5.onResponse(ActionListener.java:266) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.AbstractSearchAsyncAction.sendSearchResponse(AbstractSearchAsyncAction.java:659) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.ExpandSearchPhase.run(ExpandSearchPhase.java:132) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.AbstractSearchAsyncAction.executePhase(AbstractSearchAsyncAction.java:428) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:422) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.FetchSearchPhase.moveToNextPhase(FetchSearchPhase.java:299) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.FetchSearchPhase.lambda$innerRun$1(FetchSearchPhase.java:139) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.FetchSearchPhase.innerRun(FetchSearchPhase.java:151) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.action.search.FetchSearchPhase$1.doRun(FetchSearchPhase.java:123) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.threadpool.TaskAwareRunnable.doRun(TaskAwareRunnable.java:78) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:59) ~[opensearch-2.9.0.jar:2.9.0] at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:908) [opensearch-2.9.0.jar:2.9.0] at org.opensearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:52) [opensearch-2.9.0.jar:2.9.0] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:833) [?:?] Caused by: java.lang.Exception: org.opensearch.OpenSearchStatusException: Filter by user backend roles is enabled with security disabled.
[2023-08-29T19:19:54,356][INFO ][o.o.s.t.SecureTransportAction] [oslab-data-01 ] User and roles string from thread context: charles@
@tallyoh @lezzago Note : Previous error stack which i had shared was related to creating normal alerts flow with notification in multi tenancy. We have tested it there no issue in creating the alerts from Alerting menu.
Currently the issue i can see and we are also facing it is when creating alerts from "Security Analytics error"
[security_analytics_exception] Filter by user backend roles is enabled with security disabled.
@tallyoh @techrna
This seems to be a Security Analytics plugin issue with how they are integrating with the Alerting plugin. Please create a bug issue in the Security-Analytics plugin here and include the stack trace as well as the steps done to get the error.
Can anyone please help me on this above one.
A user reported the following via the forum:
Do you have any additional context? Here's an error log: