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

[SLOs] remove manage_transform and manage_ingest_pipeline privilege requirements #190572

Conversation

dominiqueclarke
Copy link
Contributor

@dominiqueclarke dominiqueclarke commented Aug 15, 2024

Summary

Resolves https://github.com/elastic/observability-dev/issues/3845

Removes the manage_transform and manage_ingest_pipeline privilege requirements from the SLO app.

This accomplished by replacing the existing ES client with asSecondaryAuthUser client.

The asSecondaryAuthUser client passes es-secondary-authorization headers to the related APIs. When supported, the API will use the primary auth (the kibana system user) to handle primary actions such as creating the transforms and ingest pipelines, while using secondary auth to check against index privileges. The result is the ability to for Kibana to create transforms and pipelines on behalf of the user, while respecting the users index privileges.

Testing

To test, be sure to use a less privileged user without manage_transform or manage_pipeline privileges. Begin by creating two new roles, slo_editor and slo_viewer

Index privileges for slo_editor user

.slo-*: 'write', 'read', 'read_cross_cluster', 'view_index_metadata', 'manage', 'auto_configure'

Index privileges for slo_viewer user

.slo-*: 'read', 'read_cross_cluster', 'view_index_metadata'

Then create two new users, slo_editor and slo_viewer and give them the following roles:

slo_editor: 'slo_editor', 'editor'
slo_viewer: 'slo_viewer', 'viewer'

An overall regression testing of the SLO app is desired, including:

Editor user

  1. Creating a SLI without a group by
  2. Creating a SLI with a group by
  3. Updating an SLI without a group by
  4. Updating a SLI with a group by
  5. Deleting a SLI
  6. Inspecting an SLI
  7. Resetting an SLI
  8. Receiving and viewing SLI health notifications on the SLO page
  9. Viewing SLOs

Viewer user

  1. Inspecting an SLI
  2. Receiving and viewing SLI health notifications on the SLO page
  3. Viewing SLOs

@obltmachine
Copy link

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@dominiqueclarke
Copy link
Contributor Author

Note: I have not implemented the SLO health API yet. That will need to be done before this is merged.

@dominiqueclarke
Copy link
Contributor Author

/ci

@dominiqueclarke
Copy link
Contributor Author

/ci

@dominiqueclarke dominiqueclarke force-pushed the feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements branch from c4f7651 to 501b9ba Compare August 15, 2024 19:38
@dominiqueclarke
Copy link
Contributor Author

/ci

@dominiqueclarke
Copy link
Contributor Author

/ci

@dominiqueclarke
Copy link
Contributor Author

/ci

@dominiqueclarke dominiqueclarke marked this pull request as ready for review August 21, 2024 19:22
@dominiqueclarke dominiqueclarke requested review from a team as code owners August 21, 2024 19:22
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Aug 21, 2024
const repository = new KibanaSavedObjectsSLORepository(soClient, logger);

const getSLOHealth = new GetSLOHealth(esClient, repository);
const getSLOHealth = new GetSLOHealth(esClient, scopedClusterClient, repository);
Copy link
Contributor

Choose a reason for hiding this comment

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

@dominiqueclarke I was checking all the routes in this file and I was wondering if we need to pass the scopedClusterClient to the getSloBurnRates route as well. I noticed that you didn't change the GET requests, but getSloBurnRates is POST request, so I thought we might need to pass the scopedClusterClient there as well. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There aren't any transform or ingest pipeline actions in that code path.

@mgiota
Copy link
Contributor

mgiota commented Aug 22, 2024

Here's some outcome from my manual testing:

I created an slo_editor role, but as you can see in the Video recording I can not see the Good/Bad Events Chart. When I am logged in with elastic user, Good/Bad events chart loads properly.

Screen.Recording.2024-08-22.at.13.59.59.mov

UPDATE
I haven't given my user the editor role. Once I added editor role as well, Good/Bad events charts loaded properly.
Screenshot 2024-08-22 at 14 06 38

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Kibana Security is only tagged for a review here because the changes from #190998 are not merged to this PR yet. If that is untrue please let me know.

Copy link
Contributor

@mgiota mgiota left a comment

Choose a reason for hiding this comment

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

I finished with manual testing and everything works well!

@mgiota
Copy link
Contributor

mgiota commented Aug 22, 2024

@dominiqueclarke This screenshot is not directly related to your PR, it is related to something similar I was working on regarding SLO permissions through SLO integrations. So below screenshot is from another PR

344053459-7c692fdb-89df-4592-99df-93ef1c6d1822

I'm playing around with user roles in your PR and trying to reproduce this Transform error message. Do you know what role and privileges I need to use to be able to get this Transform error message? The reason I am asking is because I am thinking we could display a Reauthorization required message directly in the SLO lists page similar to how Fleet team or ML team handle it. They have screenshots with the UI workflow they use. I can create a ticket with more details and we can discuss it with the team. What do you think?

…e-privilege-requirements' of github.com:dominiqueclarke/kibana into feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements
@mgiota
Copy link
Contributor

mgiota commented Aug 22, 2024

I am reading through the SLO permissions email thread and I found this linked issue. Do I understand correctly that we want to move away from explicit opt-ins and make it more back-box to the user? If that's the case, what I suggest above regarding a reauthorization flow is not the right way.

@dominiqueclarke dominiqueclarke requested a review from a team as a code owner August 22, 2024 18:07
@@ -33,14 +37,18 @@ export function TransformSecurityCommonProvider({ getService }: FtrProviderConte
{
name: 'transform_dest',
elasticsearch: {
indices: [{ names: ['.slo-*'], privileges: ['read', 'index', 'manage', 'delete'] }],
indices: [
{ names: ['.slo-observability.*'], privileges: TOTAL_INDEX_PRIVILEGE_SET_EDITOR },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to align this with the actual index pattern and privileges we specify for the SLO product, but I'm not sure if that's even the purpose of this test/service because it seems like it's intended to just test transforms and doesn't actually really relate to SLOs at all?

Copy link
Member

Choose a reason for hiding this comment

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

I believe best person to answer is @mgiota , she added the service

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mgiota If this is SLO related then I think this change is fine. The tests are indeed passing.

@muthu-mps
Copy link

@dominiqueclarke, @mgiota -

  • Using the es-secondary-authorization, Will this solve the authorization issue with the transform jobs creations when we create SLOs by using the default Kibana user role?
  • While removing the manage_transform and manage_ingest_pipeline privileges, we may need to update the SLO creation documentation.

@dominiqueclarke
Copy link
Contributor Author

@dominiqueclarke, @mgiota -

  • Using the es-secondary-authorization, Will this solve the authorization issue with the transform jobs creations when we create SLOs by using the default Kibana user role?
  • While removing the manage_transform and manage_ingest_pipeline privileges, we may need to update the SLO creation documentation.
  • Yes, using es-secondary-auth splits the privilege model in two, using one set of privileges, the kibana system's, for the primary action (creating, editing, deleting transforms) and another set privileges, the users, for determining access to the source and destination index
  • Yes, we will need to create a ticket to update the docs

Copy link
Member

@dmlemeshko dmlemeshko left a comment

Choose a reason for hiding this comment

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

x-pack/test_serverless/api_integration/services/transform/security_common.ts changes LGTM

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

i still see manage_transform permission listed as requirement on SLO home page

image

…e-privilege-requirements' of github.com:dominiqueclarke/kibana into feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements
…e-privilege-requirements' of github.com:dominiqueclarke/kibana into feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements
…e-privilege-requirements' of github.com:dominiqueclarke/kibana into feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements
@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 28, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: c1c9224
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-190572-c1c92248ecd0

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #69 / Cloud Security Posture Test adding Cloud Security Posture Integrations KSPM K8S KSPM K8S KSPM K8S Workflow

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
slo 916.6KB 916.5KB -113.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@dominiqueclarke dominiqueclarke merged commit 784297a into elastic:main Aug 29, 2024
23 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 29, 2024
@dominiqueclarke dominiqueclarke deleted the feat/slo-transforms-remove-transform-and-ingest-pipeline-privilege-requirements branch August 29, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project Feature:SLO release_note:enhancement Team:obs-ux-management Observability Management User Experience Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.