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

[Uptime] Users can't save ML Job alerts and see error when they don't have write access to uptime #118404

Closed
lucasfcosta opened this issue Nov 11, 2021 · 3 comments · Fixed by #120379
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.0.0 v8.1.0

Comments

@lucasfcosta
Copy link
Contributor

lucasfcosta commented Nov 11, 2021

Kibana version: 8.1.0 (Source - Hash: a51a04b)

Elasticsearch version: 8.1.0 (Remote cluster configured for CCS)

Server OS version: MacOS 11.6 Big Sur

Browser version: Version 95.0.4638.69 (Official Build) (x86_64)

Browser OS version: MacOS 11.6 Big Sur

Original install method (e.g. download page, yum, from source, etc.): Running Kibana from source, and connecting it to a remote cluster configured for CCS against oblt-dev (which was created using oblt-cli).

Describe the bug: When users don't have permissions to write to uptime, but can see the Monitors screen and create ML Jobs, they see an error when trying to create an alert on top of the monitor duration's anomaly detection.

That's confusing behaviour because the button to create the alert remains enabled on the screen despite the user not having permission to actually do so.

Steps to reproduce:

  1. Create a new role which has All privileges for Machine Learning and read-only access to Uptime, as per the screenshot below.
    Screenshot 2021-11-11 at 17 47 05
  2. Create a user and assign it the role you created in step 1 and the obs_read role, as per the screenshot below.
    Screenshot 2021-11-11 at 17 51 06
  3. Create and start a synthetic monitor. This can be a simple monitor, like one with an HTTP check, for example.
  4. Login with the user you just created and access the synthetic monitor you just created.
  5. Within the monitor's details, click Enable anomaly detection and create an ML Job for it.
  6. Try to save an alert (you don't need to add any connectors) and you'll see an error.

Expected behavior: The button to create alerts should be disabled so that users can't even open the flyout, as it currently happens on the Logs app (shown in the screenshot below).

Screenshot 2021-11-30 at 18 03 53

Screenshots (if relevant):

write-error-alert

Screenshot 2021-11-11 at 17 58 53

Errors in browser console (if relevant):

POST http://localhost:5601/ktg/api/alerting/rule 403 (Forbidden)

Provide logs and/or server output (if relevant): None.

Any additional context: This was broken out from the PR #117684 to prevent its scope from increasing indefinitely.

@lucasfcosta lucasfcosta added bug Fixes for quality problems that affect the customer experience v8.0.0 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.1.0 labels Nov 11, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime (Team:uptime)

@lucasfcosta
Copy link
Contributor Author

lucasfcosta commented Dec 1, 2021

As an update to the expected behaviour, we have decided that:

The button to create alerts should be disabled so that users can't even open the flyout, as it currently happens on the Logs app (shown in the screenshot below).

Screenshot 2021-11-30 at 18 03 53

We decided to do this because:

  1. It's a pattern already used elsewhere
  2. It doesn't require changing other team's components
  3. We'll eventually move away from the current alerting setup component

I've also updated this issue to reflect that.

lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 3, 2021
…rite permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 6, 2021
…rite permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 6, 2021
…ime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 6, 2021
…ime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 7, 2021
…rite permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 7, 2021
…ime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 7, 2021
…rite permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.
lucasfcosta added a commit to lucasfcosta/kibana that referenced this issue Dec 7, 2021
…ime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.
lucasfcosta added a commit that referenced this issue Dec 14, 2021
…rite permissions [#118404] (#120379)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.

* [Uptime] Disable "Enable Anomaly Alert" when users can't write to uptime [#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit to kibanamachine/kibana that referenced this issue Dec 14, 2021
…rite permissions [elastic#118404] (elastic#120379)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.

* [Uptime] Disable "Enable Anomaly Alert" when users can't write to uptime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@lucasfcosta lucasfcosta removed their assignment Dec 14, 2021
@dominiqueclarke dominiqueclarke self-assigned this Dec 15, 2021
kibanamachine added a commit that referenced this issue Dec 16, 2021
…time write permissions [#118404] (#120379) (#121163)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [#118404] (#120379)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.

* [Uptime] Disable "Enable Anomaly Alert" when users can't write to uptime [#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* add missing useKibana hook to ML Flyout Container for detecting uptime write permissions

Co-authored-by: Lucas F. da Costa <lucas@lucasfcosta.com>
Co-authored-by: Lucas Fernandes da Costa <lucas.costa@elastic.co>
@dominiqueclarke
Copy link
Contributor

Post FF testing LGTM. Tested with 8.0 branch.

Created a Kibana user with only read access to All Kibana privileges and read access to the heartbeat-* and synthetics-* indices.

Screen Shot 2021-12-16 at 5 36 15 PM

TinLe pushed a commit to TinLe/kibana that referenced this issue Dec 22, 2021
…rite permissions [elastic#118404] (elastic#120379)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.

* [Uptime] Disable "Enable Anomaly Alert" when users can't write to uptime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gbamparop pushed a commit to gbamparop/kibana that referenced this issue Jan 12, 2022
…rite permissions [elastic#118404] (elastic#120379)

* [Uptime] Disable 'Create Rule' button when user doesn't have uptime write permissions [elastic#118404]

Before this commit, users would be able to open the flyout to create an
alert and would end-up seeing an error toast when they tried to save it.

This commit will now disable the create alert button when the user
doesn't have permissions to write to Uptime. It will also display a
helpful tooltip.

* [Uptime] Disable "Enable Anomaly Alert" when users can't write to uptime [elastic#118404]

This commit causes users not to be able to use the "Enable Anomaly
Alert" button within the popover in the monitors screen. That button
will now be disabled and contain an informative tooltip whenever users
don't have permissions to write to Uptime.

We've chosen to take this approach so that we don't have to modify the
component which deals with the alert creation, which belongs to another
team and that we plan on eventually replacing. Furthermore, this pattern
is already used in the logs app.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v8.0.0 v8.1.0
Projects
None yet
3 participants