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

[RAC] Use alerting framework to check alert permissions in the UI #113726

Closed
mgiota opened this issue Oct 4, 2021 · 5 comments
Closed

[RAC] Use alerting framework to check alert permissions in the UI #113726

mgiota opened this issue Oct 4, 2021 · 5 comments
Labels
Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Theme: rac label obsolete

Comments

@mgiota
Copy link
Contributor

mgiota commented Oct 4, 2021

(title to be better defined)

📝 Summary

At the moment Alerts table UI needs to make use of the producer value to determine if workflow status options should be visible to the user or not (Mark as Acknowledged and Closed). In case the value of the consumer is alerts (this means the rule was created through Stack Management and not through the respective Observability App), then we use the value of the producer to determine alert permissions. In any other case we use the consumer. https://github.com/elastic/kibana/pull/110167/files#diff-f9d2565b68bb75d711c69a2d1c21a6e9c4ced3494068fee60845b93e4eca1895R213 and https://github.com/elastic/kibana/pull/110167/files#diff-f9d2565b68bb75d711c69a2d1c21a6e9c4ced3494068fee60845b93e4eca1895R309

Producer refers always to wherever the rule type is registered in the code (apm, logs, infrastructure etc). Consumer is where the rule instance was created by the end user (alerts, apm, logs, infrastructure etc). All rules of a given rule type will always have the same producer value. But they can have different consumer values based on where they are created in the UI. #107857

Above consumer/producer logic is an implementation detail and shouldn't be exposed to the UI, because it increases the likelihood of bugs. Alerts permissions logic already exists in the alerting framework and should be used to determine the visibility of UI elements. UI shouldn't duplicate this logic as it currently happens in above mentioned lines of code.

✔️ Acceptance criteria

  • Check if the existing alerting framework implementation has a method that gives back the alert permissions https://github.com/elastic/kibana/blob/master/x-pack/plugins/alerting/server/authorization/alerting_authorization.ts. If not implement a public method that returns alert permissions
  • Timelines plugin should ask the alerting framework for the read/write permissions of each alert (it most probably does it already)
  • Timelines search strategy should send the alert permissions of each row as part of the response.
  • Alerts table UI should check the returned alert permissions of each row to determine if some UI options will be visible or not.
  • Existing logic in the Alerts table UI that checks if consumer value is alerts should be deleted
@botelastic botelastic bot added the needs-team Issues missing a team label label Oct 4, 2021
@mgiota mgiota changed the title [RAC] Usage of producer/consumer fields to handle alert permissions [RAC] Use same logic of alerting framework to check alert permissions in the UI Oct 4, 2021
@mgiota mgiota changed the title [RAC] Use same logic of alerting framework to check alert permissions in the UI [RAC] Use alerting framework to check alert permissions in the UI Oct 4, 2021
@banderror
Copy link
Contributor

I'm not aware of the implementation on the Observability side and can be mistaken about all the dependencies, but we have code in rule_registry that implements RBAC and I'd guess it can be related to this issue:

  • x-pack/plugins/rule_registry/server/alert_data_client contains an implementation of RBAC-aware methods built on top of the AlertingAuthorization
  • x-pack/plugins/rule_registry/server/routes contains routes that implement RBAC-aware read and update operations

@mgiota mgiota added the Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services label Oct 5, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Oct 5, 2021
@mgiota mgiota added the Theme: rac label obsolete label Oct 5, 2021
@mgiota
Copy link
Contributor Author

mgiota commented Oct 5, 2021

@banderror Thanks for this info! It looks promising. I will look into the existing methods and see if I can reuse one for our needs or add a new one.

@weltenwort weltenwort added Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" and removed Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services labels Nov 3, 2021
@CoenWarmer
Copy link
Contributor

@simianhacker is this something we still want to do, and if we do, is this part of AO or the Alerting Framework?

@simianhacker
Copy link
Member

Looks like it's outdated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" Theme: rac label obsolete
Projects
None yet
Development

No branches or pull requests

6 participants