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

[Infra] Hosts View fails when user doesn't have permission to read Saved Objects #200151

Open
crespocarlos opened this issue Nov 14, 2024 · 2 comments · Fixed by #199841
Open
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team

Comments

@crespocarlos
Copy link
Contributor

crespocarlos commented Nov 14, 2024

Summary

When users don't have permission to read Saved Objects, the hosts view throws the error below

This happens because the code needs to get the apm-indices configuration to be able to query APM data.

Role config:

AC

  • Hosts view renders correctly regardless
@crespocarlos crespocarlos added bug Fixes for quality problems that affect the customer experience Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team labels Nov 14, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@crespocarlos crespocarlos changed the title [Infra] Hosts View throws an error when user doesn't have permission to read Saved Obejcts [Infra] Hosts View fails when user doesn't have permission to read Saved Objects Nov 14, 2024
@crespocarlos crespocarlos self-assigned this Nov 14, 2024
crespocarlos added a commit that referenced this issue Nov 21, 2024
closes [#200151](#200151)

## Summary

This PR change the `getApmIndices` function from `apm_data_access` to
fetch the information using Kibana's internal user. This was done for 2
reasons:

1 - Plugins using `savedObjects.client` might face a situation where the
logged in user doesn't have permission to read saved objects, causing
the retrieval of apm indices to fail, which could lead to unexpected
exceptions
2 - Elasticsearch is able to determine whether the user has permission
to view docs in the index patterns, therefore, it's ok to retrieve the
index pattern with Kibana's internal user because ultimately
elasticsearch will only return the data the user has access to.

### Infra app permission

**Role config:**

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/ae98a98f-570a-4139-b804-91a8de0c9d1d">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/afe29e7f-ab02-40f4-a86c-aeb016655708">


**Without access to APM indices**
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/8aa7d4e5-3484-4723-838c-54920e442c08">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/af3ce400-7a45-4313-84c7-5b8170c39bf5">

**With access to APM indices**

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/1effc137-72a2-4e5b-b2ac-62e685370a21">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/e161f6d9-85a7-4f80-a7d3-7ec0bdc338a3">


### Admin

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/d280f0d6-de6c-408f-a080-fa150d237afc">


### How to test

- Follow the steps above
- Other areas affected: assistant and profiling

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this issue Nov 26, 2024
closes [elastic#200151](elastic#200151)

## Summary

This PR change the `getApmIndices` function from `apm_data_access` to
fetch the information using Kibana's internal user. This was done for 2
reasons:

1 - Plugins using `savedObjects.client` might face a situation where the
logged in user doesn't have permission to read saved objects, causing
the retrieval of apm indices to fail, which could lead to unexpected
exceptions
2 - Elasticsearch is able to determine whether the user has permission
to view docs in the index patterns, therefore, it's ok to retrieve the
index pattern with Kibana's internal user because ultimately
elasticsearch will only return the data the user has access to.

### Infra app permission

**Role config:**

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/ae98a98f-570a-4139-b804-91a8de0c9d1d">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/afe29e7f-ab02-40f4-a86c-aeb016655708">


**Without access to APM indices**
<img width="500" alt="image"
src="https://github.com/user-attachments/assets/8aa7d4e5-3484-4723-838c-54920e442c08">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/af3ce400-7a45-4313-84c7-5b8170c39bf5">

**With access to APM indices**

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/1effc137-72a2-4e5b-b2ac-62e685370a21">

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/e161f6d9-85a7-4f80-a7d3-7ec0bdc338a3">


### Admin

<img width="500" alt="image"
src="https://github.com/user-attachments/assets/d280f0d6-de6c-408f-a080-fa150d237afc">


### How to test

- Follow the steps above
- Other areas affected: assistant and profiling

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@cauemarcondes
Copy link
Contributor

Reopening this because it was noticed that the changes made on the PR would break the APM index settings space awareness.

@cauemarcondes cauemarcondes reopened this Dec 2, 2024
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 Feature:ObsHosts Hosts feature within Observability Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants