[Detections & Response] RBAC - Add Detection Alerts kibana feature#244637
[Detections & Response] RBAC - Add Detection Alerts kibana feature#244637rylnd merged 143 commits intoelastic:mainfrom
Conversation
6435eec to
6142b80
Compare
d64c8f8 to
5898df9
Compare
96422b8 to
e217ca3
Compare
3be4a8c to
d9c710a
Compare
7cde7ab to
18f65ab
Compare
8c6db01 to
7d5a05d
Compare
9023947 to
973d61d
Compare
x-pack/solutions/security/packages/features/src/rules/v2_features/kibana_features.ts
Show resolved
Hide resolved
816e816 to
ca0a2c7
Compare
c7d2b4f to
db639e7
Compare
|
@elastic/response-ops FYI beyond checking the updated |
maximpn
left a comment
There was a problem hiding this comment.
Rule Management Area changes LGTM 👍
I've smoke tested Rule Management and Alerts with the script generated users. The behavior has expect restrictions for users. It looks good to go.
The only thing to double check is Selected data view is unavailable error toast message shown to alerts-none|rules-read users.
Details on what have been tested
I tested Rule Management and Alerts parts of the functionality for the following users
-
alerts-none|rules-noneuser
This users can't see any SIEM UI as expected.
-
alerts-none|rules-readuser
Got a toast error "Selected data view is unavailable". It appeared and disappeared quickly. I'm not sure if it's expected. -
alerts-none|rules-alluser -
alerts-read|rules-noneuser
Users may see rule and exception ids written to the alert. This seems to be expected. Anyway the rules management page is unavailable without rules permissions.
alerts-read|rules-readuseralerts-read|rules-alluseralerts-all|rules-noneuseralerts-all|rules-readuseralerts-all|rules-alluser
| selectedRowsCount === 0 || | ||
| selectedRowsCount === undefined || | ||
| bulkActions.length === 0 || | ||
| !bulkActions.some((panel) => panel.items?.length); |
There was a problem hiding this comment.
Was it a bug not taking panel.items into account?
There was a problem hiding this comment.
Yes, that's why I fixed it 😉 . However, it wasn't a bug prior to this branch, since there wasn't previously a user who could see the alerts table but lacked alert actions. I detailed this in 84c6d94.
| import type { ProductFeatureParams } from '../types'; | ||
| import { alertsDefaultProductFeaturesConfig } from './product_feature_config'; | ||
|
|
||
| export const getAlertsFeature = (): ProductFeatureParams<ProductFeatureAlertsKey, string> => ({ |
There was a problem hiding this comment.
I wonder whether we should comment on what a security feature does. We have increasing number of security features where the boundary might be not 100% clear. There is a Google Sheet(s) describing the behavior but it lives separately. A comment could make the description clearer to the code.
WDYT?
| getUserPrivilegesMockDefaultValue({ | ||
| rulesPrivileges: { | ||
| rules: { | ||
| read: true, |
There was a problem hiding this comment.
Should we have tests without rules permissions?
There was a problem hiding this comment.
I think that in general for these tests: a "happy path" "everything gets rendered" makes sense at the top level, along with breaking out privilege-specific tests at whichever level they're handled.
There are more specific tests in child components (e.g. Header) to this one, and this particular component doesn't have any privilege-specific logic at this level, but: I did add one high level "does not render 'Manage Rules'" test in 5517d72.
| expect(getExpectedLandingTab(defaultLandingTab)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('redirects to the default landing tab when user does not have access to endpoint exceptions', () => { |
There was a problem hiding this comment.
How should it work with #258556? Endpoint exceptions will be moved out. Do we expect to apply the same RBAC to the tab?
There was a problem hiding this comment.
If the user does not have access to Endpoint Exceptions, then whether/where it's been moved isn't relevant to them.
If there is some other expected behavior here, please clarify.
This must've been the result of a bad merge resolution.
Asserts that we do not render the "Manage Rules" link if you do not have access.
Conflicts: x-pack/solutions/security/plugins/security_solution/public/flyout_v2/document/document_flyout_wrapper.test.tsx x-pack/solutions/security/plugins/security_solution/public/flyout_v2/document/document_flyout_wrapper.tsx x-pack/solutions/security/plugins/security_solution/public/flyout_v2/document/tabs/overview_tab.tsx
cnasikas
left a comment
There was a problem hiding this comment.
ResponseOps file changes LGTM! I did not review the RBAC changes.
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Comment |
Conflicts: x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_details_ui/pages/rule_details/use_rule_details_tabs.tsx x-pack/solutions/security/plugins/security_solution/public/rules/routes.tsx
The component had a conflict, but an added test referred to the old parameter.
Conflicts: x-pack/solutions/security/plugins/security_solution/public/common/components/toolbar/bulk_actions/use_bulk_alert_closing_reason_items.tsx
dhurley14
left a comment
There was a problem hiding this comment.
Detection engine codeowners changes are straightforward and look good. I tested that the roles are migrated correctly too.
Read privileges migration
Dev tools shows no explicit alerts privileges for the security read role I created in main:
Here is the privilege summary for that same role when I switch to this branch, correctly showing the user role has Read for alerts, which is carried over from the Rules privilege, despite not having it explicitly in the role definition (see dev tools above) 👍 :
All privileges migration
Dev tools shows no explicit alerts privileges for the security all role I created in main:
Here is the privilege summary for that same role when I switched to this branch, correctly showing the user role has All for alerts, which is carried over from the Rules privilege despite not having it explicitly in the role definition (see dev tools above) 👍:
One component was renamed, and a new component was added to the hierarchy causing some additional mocks.
Conflicts: x-pack/solutions/security/plugins/security_solution/public/flyout_v2/shared/components/flyout_provider.test.tsx x-pack/solutions/security/plugins/security_solution/public/flyout_v2/shared/components/flyout_provider.tsx x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_header_component/index.test.tsx x-pack/solutions/security/plugins/security_solution/public/one_discover/alert_flyout_overview_tab_component/index.test.tsx
⏳ Build in-progress
History
cc @rylnd |
What this Does
This PR introduces Alerts RBAC: a dedicated Kibana feature (
securitySolutionAlertsV1) for controlling who can view and edit detection alerts. Alerts permissions are moved out of the Rules feature and into this new Alerts feature, so that access to alerts (viewing, updating status, assigning, tagging) can be granted independently from rules (managing detection rules):The change is part of the broader Security Solution RBAC Epic and follows the same pattern as:
Summary of what moves:
securitySolutionAlertsV1)edit(or legacy deprecated privilege for backward compatibility)New privilege model:
read_alerts(UI),alerts-read(API). View alerts, open flyouts, see tables.edit_alerts(UI),alerts-all(API). All of the above plus: change status, set assignees, set tags, bulk actions.Backward compatibility is preserved for existing roles: users with only legacy Security (siem/siemV2/siemV3/siemV4) or Rules (securitySolutionRulesV1/V2) read access still get a deprecated “update alerts” capability so they can continue to perform alert updates until roles are migrated.
Note also that, similarly to the previous PRs for this epic, this does not update the prebuilt/test roles, which will come in a subsequent PR. This means that using an existing prebuilt role will implicitly exercise the role migration path, as do the existing tests.
How to Review
Permissions change (high level)
ALERTS_API_ALLorALERTS_API_UPDATE_DEPRECATED_PRIVILEGE. Read-only alert operations requireALERTS_API_READ.read_alerts/edit_alerts; the capability switcher grants the deprecated update capability to legacy Security and Rules features so existing roles keep update behavior.Testing setup
alerts-all|rules-none(password:changeme).Areas of Interest
Please verify behavior in these areas with Alerts read only vs Alerts read + edit (and, if possible, Rules without Alerts and Alerts without Rules).
Alerts Page
Timeline
Rule Details – Alerts tab
Entity analytics (EA) – Risk contributions / flyout
Cases
Alerts Flyout
Checklist for Reviewers
Related links
Checklist
release_note:breakinglabel should be applied in these situations.