-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 in 7.x #113172
[SECURITY] Deprecated sub feature cases in security solutions in 7.x #113172
Conversation
Pinging @elastic/kibana-security (Team:Security) |
Pinging @elastic/security-threat-hunting-cases (Team:Threat Hunting:Cases) |
This comment has been minimized.
This comment has been minimized.
const siemPrivs = new Set<string>(); | ||
const casesPrivs = new Set<string>(); | ||
|
||
for (const priv of siemPrivileges) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jonathan-buttner, your idea to use a switch and a set make it more readable and easier to understand. Thanks for the suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the refactor 👍 Xavier and I paired on testing this too although we didn't test a full upgrade. Might be good to get QA to test that?
Will review this first thing tomorrow morning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline --
This looks great so far, but I think we need four changes:
- Update UI text to make sure that it is in line with the 7.16 upgrade assistant guidance
- The API call fails because the request payload contains an unexpected
deprecationDetails
field. It looks like the deprecations client is adding this automatically. We should submit a PR for 8.0/7.16 that adds aomitDeprecationDetails
field, which the deprecations client should respect. - Changing the existing "siem" feature privilege can unintentionally grant more access to a user in 7.16. For example, if the role has
{ siem: ['minimal_read'] }
, the "Quick resolve" button changes that to{ siem: ['read'] }
. So we need to submit a PR for 8.0 that changes "siem" to something else like "securitySolutionApp", and change this code to add the new feature privilege without changing the existing one. Then, if the role has{ siem: ['minimal_read'] }
, the "Quick resolve" button should change that to{ siem: ['minimal_read'], securitySolutionApp: ['read'] }
. - We should ensure that after the user fixes the role, it doesn't show in the upgrade assistant anymore. You should be able to filter out any roles that contain feature privileges for "securitySolutionApp" or "securitySolutionCases".
Another thing I thought of: if the user had a Gold license at one point, and added a role with sub-feature privileges, and then downgraded to Basic, the role's sub-feature privileges are essentially "zombie privileges" -- they exist but they don't grant access to anything. But honestly it's probably such an edge case, I don't think we really need to change this feature deprecation to take that into account. I'm interested to hear what @legrego thinks, though.
Edit: here are a couple of screenshots of the flyout in the upgrade assistant...
With my suggested text changes:
I chatted with the Stack Management team and I think we are in agreement that if there are no manual steps, the flyout should not render that "Fix manually" header at all. I'll add a comment here if they decide to update the flyout to remove that. Otherwise, we should add a manual step placeholder, like "Click the 'Quick resolve' button below", so we don't have an empty section there.
x-pack/plugins/security_solution/server/deprecation_privileges/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/deprecation_privileges/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/deprecation_privileges/index.ts
Outdated
Show resolved
Hide resolved
It's a good question. Consider a role with The odds of this happening are quite small, as the license downgrade would have resulted in revoked access for one or more users, which had then gone unnoticed and uncorrected up until the point they run the UA. I'd consider this a nice-to-have, but not blocking.
Great catch @jportner, sorry I hadn't considered this when we had discussed this earlier, @XavierM 😬 |
Yeah, that's my understanding as well. OK, agreed that handling this is a nice-to-have but not blocking 👍 |
waiting on this PR now #114399 |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We tested it together 👍
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested by creating six roles:
- with
siem: ['all']
- with
siem: ['read']
- with
siem: ['minimal_all', 'cases_all', 'cases_read']
- with
siem: ['minimal_read', 'cases_read']
- with
siem: ['minimal_all']
- with
siem: ['minimal_read']
I would expect roles 1-4 to show in the upgrade assistant, and I would expect roles 5-6 to be hidden (because they don't currently grant access to Cases, so they don't need to be changed).
However, all roles showed in the upgrade assistant. When I clicked "Quick resolve" for role 5, of course nothing happened. Then I clicked "Quick resolve" for role 1, and refreshed, and all of the other deprecations were gone.
I think you need to make two changes and update tests accordingly; see comments below 😄
x-pack/plugins/security_solution/server/deprecation_privileges/index.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/deprecation_privileges/index.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of tiny nits, but LGTM! I think we are exercising everything that we need to in the tests.
x-pack/plugins/security_solution/server/deprecation_privileges/index.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/deprecation_privileges/index.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/deprecation_privileges/index.test.ts
Outdated
Show resolved
Hide resolved
…/index.test.ts Co-authored-by: Joe Portner <[email protected]>
…/index.test.ts Co-authored-by: Joe Portner <[email protected]>
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
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.