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

[SECURITY] Deprecated sub feature cases in security solutions #112695

Closed
wants to merge 7 commits into from

Conversation

XavierM
Copy link
Contributor

@XavierM XavierM commented Sep 21, 2021

Summary

Create an Upgrade Assistant automated fix to rewrite roles that are granting access to the Cases sub-feature to use the new top-level Cases feature

#109158

Checklist

Delete any items that are not applicable to this PR.

@XavierM XavierM requested review from a team as code owners September 21, 2021 16:57
@XavierM XavierM added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Team:Threat Hunting:Cases labels Sep 21, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@XavierM
Copy link
Contributor Author

XavierM commented Sep 24, 2021

@elasticmachine merge upstream

@XavierM
Copy link
Contributor Author

XavierM commented Sep 27, 2021

@elasticmachine merge upstream

const statusCode = getErrorStatusCode(e);
const isUnauthorized = statusCode === 403;
const message = isUnauthorized
? `You must have the 'manage_security' cluster privilege to fix role deprecations.`
Copy link
Contributor Author

@XavierM XavierM Sep 27, 2021

Choose a reason for hiding this comment

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

I need to convert that to i18n and the other ones

@XavierM XavierM removed the v8.0.0 label Sep 27, 2021
`);
});
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's possible to get in the following state:

image

image

Could we add a test for

[minimal_all, cases_read, cases_all]

Copy link
Contributor Author

@XavierM XavierM Sep 27, 2021

Choose a reason for hiding this comment

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

I also imagine we can have [minimal_read, cases_read, cases_all]

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 will add them just in case

}, []);

const casePrivileges =
siemPrivileges.includes('minimal_read') || siemPrivileges.includes('minimal_all')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably an impossible scenario but could a role ever have:

siemPrivileges: [all, cases_read]

If that happens we'd give the role cases all when it had only read.

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 do not think that's possible, let me ask the expert @legrego

Copy link
Member

Choose a reason for hiding this comment

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

@XavierM The UI will not permit this, but there is nothing stopping an API consumer from specifying this. If both all and cases_read are specified, then they will get the sum of those two privileges, which I expect would just be all, as cases_read is a subset of all IIRC.

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 will add these tests too

@XavierM XavierM changed the base branch from master to 7.x September 27, 2021 17:30
@XavierM XavierM changed the base branch from 7.x to master September 27, 2021 17:33
@XavierM
Copy link
Contributor Author

XavierM commented Sep 27, 2021

I created this PR instead because the deprecation can only go in 7.x and I created another PR to add privilege deprecations services in security plugin

I applied all the review form @jonathan-buttner in the PR below
#113172

@XavierM XavierM closed this Sep 27, 2021
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
security 452 453 +1

Async chunks

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

id before after diff
security 480.9KB 480.9KB +2.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
security 6 7 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
security 48.1KB 48.2KB +22.0B
Unknown metric groups

API count

id before after diff
security 112 113 +1

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v7.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants