Skip to content

[Security Solution] Rules managment RBAC subfeatures#250131

Merged
dplumlee merged 122 commits intoelastic:mainfrom
dplumlee:rules-managment-rbac-subfeatures
Apr 6, 2026
Merged

[Security Solution] Rules managment RBAC subfeatures#250131
dplumlee merged 122 commits intoelastic:mainfrom
dplumlee:rules-managment-rbac-subfeatures

Conversation

@dplumlee
Copy link
Copy Markdown
Contributor

@dplumlee dplumlee commented Jan 22, 2026

Resolves: https://github.com/elastic/security-team/issues/14598
Resolves: https://github.com/elastic/security-team/issues/15244
Resolves: #246471
Based off this PR: #244637

Overview

Adds the following new subfeatures to the Rules RBAC feature within security solution:

  • security_solution_investigation_guide_edit: ability to modify the note field on detection rules
  • security_solution_custom_highlighted_fields_edit: ability to modify the investigation_fields field on detection rules
  • security_solution_enable_disable_rules: ability to enable/disable detection rules
  • security_solution_manual_run_rules: ability to manually run detection rules
  • security_solution_rules_management_settings: ability to access rules management settings
Screenshot 2026-02-10 at 9 08 28 PM

Summary

All of these subfeatures are included in the rules:all feature and can be added as extra permissions to a role with only rules:read capabilities.

This PR modifies detection rules UI to support the new granular permissions logic. The rules table has been updated to handle new edge cases with bulk actions when a user only has rules:read permissions as well as the rule edit page and MITRE coverage overview page.

We also modify the API behavior for the rules PUT, rules PATCH, and bulk actions endpoints to be able to edit specific rule params (e.g. note, investigation_fields, enable, etc.) with read only permissions as long as the user has the corresponding subfeature permission. This involved implementing a new server-side permission check that is accessible via the securitySolution context.

The exceptions_list subfeature has also been added to the granular permission PUT route logic along with the new subfeatures added in this PR.

Automated testing

Lastly, this PR adds a lot of test coverage (jest and ess integration) to the logic implemented in both this PR and #245722, and covers the many new edge cases that the granular permissions create. Unit tests have been added for the detection rules client logic in:

  • detection_rules_client.patch_rule.test.ts
  • detection_rules_client.update_rule.test.ts

And FTR tests have been added for our CRUD and bulk actions operations in:

  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_patch/trial_license_complete_tier/patch_rules.ts
  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_update/trial_license_complete_tier/update_rules.ts
  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_enable_disable.ts
  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action.ts
  • x-pack/solutions/security/test/security_solution_api_integration/test_suites/detections_response/rules_management/rule_bulk_actions/trial_license_complete_tier/perform_bulk_action_dry_run.ts

Screenshots

All taken with the rules-read-subfeatures-all listed in the testing utils section below

Rules table bulk actions - now interact-able with rules:read and new rules subfeatures

Screenshot 2026-02-10 at 9 14 37 PM

Rules table row overflow menu - now a user can manually run a rule with read permissions if the have the correct permissions

Screenshot 2026-02-10 at 9 16 02 PM

Rule edit page - a user can now use the rule edit form if they have the permissions to modify note or investigation_fields

Screenshot 2026-02-10 at 9 15 48 PM

Testing Utils

Testing configs and scripts This bash script will add/update the kibana roles defined in the config.yml file into your local instance. Usernames will be the same as the role titles and all passwords are set to a default `changeme`. In this file we have `rules-all`, `rules-read`, and `rules-read-subfeatures-all` which can be modified to omit certain permissions based on whatever testing is needed.

config.yaml
rbac-ess-testing-roles.sh

@dplumlee dplumlee self-assigned this Jan 22, 2026
@dplumlee dplumlee added ci:cloud-deploy Create or update a Cloud deployment ci:project-deploy-security Create a Security Serverless Project v9.4.0 Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. release_note:feature Makes this part of the condensed release notes Team:Detection Rule Management Security Detection Rule Management Team Feature:Detection Alerts/Rules RBAC Security Solution RBAC for rules and alerts Team:Detection Engine Security Solution Detection Engine Area backport:version Backport to applied version labels labels Feb 6, 2026
@dplumlee dplumlee force-pushed the rules-managment-rbac-subfeatures branch from d263d07 to 9063a26 Compare February 6, 2026 01:27
@elastic elastic deleted a comment from elasticmachine Feb 10, 2026
@elastic elastic deleted a comment from elasticmachine Feb 10, 2026
@pborgonovi
Copy link
Copy Markdown
Contributor

pborgonovi commented Feb 11, 2026

PR Testing

Case 1

Rules:Read + Alerts:Read

  • Opening Rules page I get the following:
    • feature_securitySolutionRulesV4.all is missing
      • Role is set to Rules Read. Do we still display this warning?
    • feature_securitySolutionAlertsV1.all is missing
      • Role is set to Alerts Read - do we still display this warning?
    • Missing read, write, view_index_metadata, manage privileges for the .alerts-security.alerts-default
      • Does the role still require index privilege despite of having Alerts subfeature set to Read?
  • Opening Rule Details page and scrolling down: no alerts tab, the space is blank until I select either exceptions or executions tab.
Role definition ``` { "rulesread-alertsread": { "cluster": [ "all" ], "indices": [ { "names": [ "auditbeat-*" ], "privileges": [ "all" ], "field_security": { "grant": [ "*" ], "except": [] }, "allow_restricted_indices": false }, { "names": [ ".items-*", ".lists-*" ], "privileges": [ "manage", "view_index_metadata", "read", "write" ], "field_security": { "grant": [ "*" ] }, "allow_restricted_indices": false } ], "applications": [ { "application": "kibana-.kibana", "privileges": [ "feature_siemV5.all", "feature_securitySolutionRulesV4.read", "feature_securitySolutionAlertsV1.read", "feature_dev_tools.all" ], "resources": [ "*" ] } ], "run_as": [], "metadata": {}, "transient_metadata": { "enabled": true }, "description": "Rules read / Alerts read" } } ``` Screenshot 2026-02-11 at 10 50 40 AM
Screenshots
Screen.Recording.2026-02-11.at.10.52.59.AM.mov
image

Case 2

Rules: Read + Alerts All

  • Missing read, write, view_index_metadata, manage privileges for the .alerts-security.alerts-default index
    • Does the role still require index privilege despite of having Alerts subfeature set to All?
  • Missing all privileges for the securitySolutionRulesV4 feature.
    • Should this be displayed? This role has Rules Read
image

@pborgonovi
Copy link
Copy Markdown
Contributor

@dplumlee

when no alerts index is present we are showing error messages due to field not located. I suppose these fields should be blank until an index exists?

image image

@dplumlee
Copy link
Copy Markdown
Contributor Author

@pborgonovi Looking at this it seems to be something better suited to be fixed in the alerts RBAC PR since that's where most of the alerting stuff is changed

@chetnarajput-qasource
Copy link
Copy Markdown

/ci

1 similar comment
@chetnarajput-qasource
Copy link
Copy Markdown

/ci

@chetnarajput-qasource chetnarajput-qasource added ci:cloud-persist-deployment Persist cloud deployment indefinitely and removed ci:cloud-persist-deployment Persist cloud deployment indefinitely labels Mar 24, 2026
denar50 added 6 commits March 26, 2026 15:19
- relax the requirement to call GET /api/detection_engine/privileges so now roles with alert permissions can call it
- enforce ALERTS_API_ALL for routes that make changes to alerts
instead of hard coding the landing tab in every place where we redirect, we will instead redirect to the rule details page and let the router determine in which tab tab the user should land based on their permissions.
handle the case where a user receives a url with a tab they don't have access to.
Copy link
Copy Markdown
Contributor

@rgodfrey-elastic rgodfrey-elastic left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for adding the maxSize

@dplumlee dplumlee requested a review from cnasikas April 3, 2026 18:54
});

export const bulkEditParamsOperationsSchema = schema.arrayOf(bulkEditParamsOperationSchema, {
minSize: 1,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Maybe you can skip calling bulkEditRuleParamsWithReadAuth if the array is empty?

ids: schema.maybe(schema.arrayOf(schema.string(), { minSize: 1 })),
operations: bulkEditParamsOperationsSchema,
operations: schema.arrayOf(bulkEditParamsOperationSchema, {
maxSize: 2000,
Copy link
Copy Markdown
Member

@cnasikas cnasikas Apr 6, 2026

Choose a reason for hiding this comment

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

Could we add the max size to bulkEditParamsOperationsSchema instead and keep the minSize (basically revert the change here and use bulkEditParamsOperationsSchema)? Could my suggestion to skip calling bulkEditRuleParamsWithReadAuth in your code if the array is empty? If not, could we at least be sure that inside the bulkEditRuleParamsWithReadAuth we skip if the operations array is empty?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Talked with @cnasikas about this more in slack. Basically, removing the minSize here is the easier schema refactor of the possible options to maintain current workflows with the new RBAC logic being added. A better path in the future would probably entail adding the add and delete operations to bulkEditParamsOperationsSchema (which right now only allows set). This could allow us to reduce our dependency on the paramsModifier that we currently use in our bulk actions methods (and is responsible for the use case of an empty operations array). Made a slight modification in accordance to this comment but leaving the rest of it for now.

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 6, 2026

⏳ Build in-progress

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #9 / AssetDocumentTab should select table tab when path tab is table

History

cc @denar50 @dplumlee

@dplumlee dplumlee merged commit d8886a4 into elastic:main Apr 6, 2026
19 checks passed
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Apr 6, 2026
@dplumlee dplumlee deleted the rules-managment-rbac-subfeatures branch April 6, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:cloud-deploy Create or update a Cloud deployment ci:cloud-persist-deployment Persist cloud deployment indefinitely ci:project-deploy-security Create a Security Serverless Project Feature:Detection Alerts/Rules RBAC Security Solution RBAC for rules and alerts release_note:feature Makes this part of the condensed release notes Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security Solution] Server-side granular permissions check for rules RBAC