Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acknowledge api unresponsive when plugins.alerting.filter_by_backend_roles is enabled #1332

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbcd90
Copy link
Collaborator

@sbcd90 sbcd90 commented Dec 20, 2023

Issue #, if available:

Description of changes:
Acknowledge Alerts transport action internally makes a call to Get monitor transport action to get the corresponding monitor object belonging to the alert. https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt#L88

the Get monitor transport action first validates the backend roles before proceeding. https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt#L87
But Acknowledge Alerts transport action already stashes the threadcontext before making Get monitor transport action call. https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt#L86
So, the user received from threadcontext by Get monitor transport action is null. https://github.com/opensearch-project/alerting/blob/main/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt#L81

hence it throws following exception:

AlertingException[Filter by user backend roles is enabled with security disabled.]; nested: Exception[org.opensearch.OpenSearchStatusException: 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:50)
    at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:79)
    at org.opensearch.alerting.transport.TransportGetMonitorAction.doExecute(TransportGetMonitorAction.kt:50)
    at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:219)
    at org.opensearch.indexmanagement.controlcenter.notification.filter.IndexOperationActionFilter.apply(IndexOperationActionFilter.kt:39)
    at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:217)
    at org.opensearch.indexmanagement.rollup.actionfilter.FieldCapsFilter.apply(FieldCapsFilter.kt:118)
    at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:217)
    at org.opensearch.performanceanalyzer.action.PerformanceAnalyzerActionFilter.apply(PerformanceAnalyzerActionFilter.java:78)
    at org.opensearch.action.support.TransportAction$RequestFilterChain.proceed(TransportAction.java:217)
    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:217)
    at org.opensearch.action.support.TransportAction.execute(TransportAction.java:189)
    at org.opensearch.action.support.TransportAction.execute(TransportAction.java:108)
    at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:110)
    at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:97)
    at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:476)
    at org.opensearch.alerting.transport.TransportAcknowledgeAlertAction$doExecute$1$1$getMonitorResponse$1.invoke(TransportAcknowledgeAlertAction.kt:99)

& call becomes unresponsive.

CheckList:

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@praveensameneni
Copy link
Member

Can you please backport to all the supported versions after the PR is reviewed and merged

Copy link
Collaborator

@engechas engechas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failing, code LGTM

Copy link
Collaborator

@riysaxen-amzn riysaxen-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing

@goyamegh
Copy link
Contributor

Please check the failing CIs.

…s enabled

Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants