Skip to content

[Response Ops][Alerting] Adding new alerting actions to allow more fine grained rule privileges#237526

Merged
ymao1 merged 13 commits intoelastic:mainfrom
ymao1:alerting/ro-459
Oct 27, 2025
Merged

[Response Ops][Alerting] Adding new alerting actions to allow more fine grained rule privileges#237526
ymao1 merged 13 commits intoelastic:mainfrom
ymao1:alerting/ro-459

Conversation

@ymao1
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 commented Oct 3, 2025

Resolves https://github.com/elastic/response-ops-team/issues/459

Summary

In order to support allowing users to enable/disable rules and trigger manual rule with alerting rule read privilege, we're adding two new alerting privileges that can be used to add subfeature privileges to existing features. This PR adds those privileges and adds functional tests for them but they are currently unused by any feature privilege.

manual_run - when added as a subfeature privilege, this allows users to schedule/delete backfill rule runs and fill gaps
enable - when added as a subfeature privilege, this allows users to enable, disable, bulk enable and bulk disable rules.

@ymao1 ymao1 changed the title Adding new alerting actions that can be used inside subfeature privil… [Response Ops][Alerting] Adding new alerting actions to allow more fine grained rule privileges Oct 3, 2025
@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 7, 2025

@elasticmachine merge upstream

@nkhristinin
Copy link
Copy Markdown
Contributor

@rylnd @ymao1 Hi I am curios, how/when we will check for those privileges in the future? On the API level?

If those API are internal for alerting, but our privileges related to security solution how it should work?

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 10, 2025

@nkhristinin This PR splits the privileges for manual run and enable/disable out at the security level so the privilege check that already exists in the rules client should be sufficient. It is expected that security solution would add some subfeature privileges to their roles that allow users read+ access to the alerting rules. There is an example of this subfeature privilege in the functional test setup in this PR here: https://github.com/elastic/kibana/pull/237526/files#diff-820d9257549da78d552581e78b6f5fa1229d82c958312de5e880f110d11a75b2. Let me know if I've misunderstood the issue! Happy to iterate

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 14, 2025

@elasticmachine merge upstream

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 21, 2025

@elasticmachine merge upstream

Comment thread x-pack/platform/plugins/shared/features/common/feature_kibana_privileges.ts Outdated
Comment thread x-pack/platform/plugins/shared/features/common/feature_kibana_privileges.ts Outdated
@denar50
Copy link
Copy Markdown
Contributor

denar50 commented Oct 22, 2025

I have used our RBAC PR which contains the new rule feature, and added the new privileges to the alerting configuration for the read only role. Basically, I replaced this line with:

rule: { read: alertingFeatures, enable: alertingFeatures, manual_run: alertingFeatures },

Then I created a role with rule:read and attached that role to a user. I was able to successfully enable/disable rules as well as triggering a manual run for them.
From a consumer of the alerting framework perspective this LGTM!

@ymao1 ymao1 self-assigned this Oct 22, 2025
@ymao1 ymao1 added Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.3.0 labels Oct 22, 2025
@ymao1 ymao1 marked this pull request as ready for review October 22, 2025 12:30
@ymao1 ymao1 requested review from a team as code owners October 22, 2025 12:30
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Copy Markdown
Contributor

@ersin-erdal ersin-erdal left a comment

Choose a reason for hiding this comment

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

LGTM
Tested locally by adding enable and manual_run to Stack Rules read privileges.
Created a user with Stack Rules read privilege.
Even though the enable/disable button was not active on the UI, I was able to enable/disable a stack rule via curl.
It didn't work (403) for the same user after removing enable and manual_run from the privilege definition.

Copy link
Copy Markdown
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

I performed similar review to @denar50, and verified that these new actions work for the behaviors that we're attempting. LGTM

Copy link
Copy Markdown
Contributor

@SiddharthMantri SiddharthMantri left a comment

Choose a reason for hiding this comment

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

Feature privilege changes LGTM.

Copy link
Copy Markdown
Member

@gsoldevila gsoldevila left a comment

Choose a reason for hiding this comment

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

Core changes LGTM (code review only)

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 24, 2025

@elasticmachine merge upstream

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Oct 24, 2025

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @ymao1

@darnautov
Copy link
Copy Markdown
Contributor

@elasticmachine merge upstream

@ymao1 ymao1 merged commit 9e2cb54 into elastic:main Oct 27, 2025
13 checks passed
@ymao1 ymao1 deleted the alerting/ro-459 branch October 27, 2025 12:38
denar50 added a commit that referenced this pull request Mar 6, 2026
…252703)

# If you're here because your Kibana feature suddenly changed...
That is happening because this PR is extracting features from
`alerting.rule.all`, namely `enable`, `manual_run` and
`manage_rule_settings` (see [this
change](https://github.com/elastic/kibana/pull/252703/changes#diff-dc097e1e414af2ca21196b12c7d901373108da58de4dd7505cc169b0e62ec2d3L75)).
Your role had `alerting.rule.all`, so I added the rest of the features
to it to ensure backwards compatibility. If you think your Kibana
feature doesn't need any of those, you're welcome to remove them in a
follow up PR.
# Summary
ResposneOps previously created two alerting features on rules SOs in
[this PR](#237526): `enable` and
`manual_run`, in order to enable the RBAC efforts in the Detection
Engine.

Now we are introducing a sub feature within the Rules feature inside the
security solution to grant access to "rule settings management" which
comprises the ability to manage the gap fill schedulers (see the ticket
[here](elastic/security-team#15244)).

However we encountered that there is no alerting privilege for rules
that matches this new Kibana sub feature.
Additionally we found that the existing `alerting.rule.all` feature does
not allow us to toggle privileges off once it is granted (see the video
below where we are able to bypass rules rbac permissions by calling an
endpoint that performs authorization using only alerting privileges)


https://github.com/user-attachments/assets/de2a38cd-259e-48aa-b1f2-a38c88f2de88

Therefore this PR :
- introduces a new feature called `manage_rule_settings` feature for
rule SOs in the alerting framework based on the previous PR.
- fixes the issue where users with `alerting.rule.all` will always have
all permissions of subfeatures even when they are explicitly toggled off
through the Kibana Security role management UI.
This is done by extracting the new alerting features from
`alerting.rule.all` into their own features. This triggers a change in
all existing Kibana features that previously included
`alerting.rule.all` since now we will have to explicitly add `enable`,
`manual_run` and `manage_rule_settings` in those places.

# How was this tested?
I put these commits on top of my branch where I have the "Rules
management settings" sub feature which is using the alerting feature
provided in this PR.

## `manage_rule_settings`
I create a role with read only access to the rule feature and only this
sub feature enable. I am then able to create operate the gap fill
scheduler. See the video below 👇



https://github.com/user-attachments/assets/2bc285a4-d35a-412c-a9fd-2153fdec1b9e


## Issue with `alerting.rule.all`
I created a role that has all the permissions for rules, I toggled off
`enable` and then tried to reproduce the issue I previously recorded.


https://github.com/user-attachments/assets/42d47fbf-5dd0-47ff-8f04-2a8f1c0591f9

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kapral18 pushed a commit to kapral18/kibana that referenced this pull request Mar 9, 2026
…lastic#252703)

# If you're here because your Kibana feature suddenly changed...
That is happening because this PR is extracting features from
`alerting.rule.all`, namely `enable`, `manual_run` and
`manage_rule_settings` (see [this
change](https://github.com/elastic/kibana/pull/252703/changes#diff-dc097e1e414af2ca21196b12c7d901373108da58de4dd7505cc169b0e62ec2d3L75)).
Your role had `alerting.rule.all`, so I added the rest of the features
to it to ensure backwards compatibility. If you think your Kibana
feature doesn't need any of those, you're welcome to remove them in a
follow up PR.
# Summary
ResposneOps previously created two alerting features on rules SOs in
[this PR](elastic#237526): `enable` and
`manual_run`, in order to enable the RBAC efforts in the Detection
Engine.

Now we are introducing a sub feature within the Rules feature inside the
security solution to grant access to "rule settings management" which
comprises the ability to manage the gap fill schedulers (see the ticket
[here](elastic/security-team#15244)).

However we encountered that there is no alerting privilege for rules
that matches this new Kibana sub feature.
Additionally we found that the existing `alerting.rule.all` feature does
not allow us to toggle privileges off once it is granted (see the video
below where we are able to bypass rules rbac permissions by calling an
endpoint that performs authorization using only alerting privileges)


https://github.com/user-attachments/assets/de2a38cd-259e-48aa-b1f2-a38c88f2de88

Therefore this PR :
- introduces a new feature called `manage_rule_settings` feature for
rule SOs in the alerting framework based on the previous PR.
- fixes the issue where users with `alerting.rule.all` will always have
all permissions of subfeatures even when they are explicitly toggled off
through the Kibana Security role management UI.
This is done by extracting the new alerting features from
`alerting.rule.all` into their own features. This triggers a change in
all existing Kibana features that previously included
`alerting.rule.all` since now we will have to explicitly add `enable`,
`manual_run` and `manage_rule_settings` in those places.

# How was this tested?
I put these commits on top of my branch where I have the "Rules
management settings" sub feature which is using the alerting feature
provided in this PR.

## `manage_rule_settings`
I create a role with read only access to the rule feature and only this
sub feature enable. I am then able to create operate the gap fill
scheduler. See the video below 👇



https://github.com/user-attachments/assets/2bc285a4-d35a-412c-a9fd-2153fdec1b9e


## Issue with `alerting.rule.all`
I created a role that has all the permissions for rules, I toggled off
`enable` and then tried to reproduce the issue I previously recorded.


https://github.com/user-attachments/assets/42d47fbf-5dd0-47ff-8f04-2a8f1c0591f9

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
…lastic#252703)

# If you're here because your Kibana feature suddenly changed...
That is happening because this PR is extracting features from
`alerting.rule.all`, namely `enable`, `manual_run` and
`manage_rule_settings` (see [this
change](https://github.com/elastic/kibana/pull/252703/changes#diff-dc097e1e414af2ca21196b12c7d901373108da58de4dd7505cc169b0e62ec2d3L75)).
Your role had `alerting.rule.all`, so I added the rest of the features
to it to ensure backwards compatibility. If you think your Kibana
feature doesn't need any of those, you're welcome to remove them in a
follow up PR.
# Summary
ResposneOps previously created two alerting features on rules SOs in
[this PR](elastic#237526): `enable` and
`manual_run`, in order to enable the RBAC efforts in the Detection
Engine.

Now we are introducing a sub feature within the Rules feature inside the
security solution to grant access to "rule settings management" which
comprises the ability to manage the gap fill schedulers (see the ticket
[here](elastic/security-team#15244)).

However we encountered that there is no alerting privilege for rules
that matches this new Kibana sub feature.
Additionally we found that the existing `alerting.rule.all` feature does
not allow us to toggle privileges off once it is granted (see the video
below where we are able to bypass rules rbac permissions by calling an
endpoint that performs authorization using only alerting privileges)


https://github.com/user-attachments/assets/de2a38cd-259e-48aa-b1f2-a38c88f2de88

Therefore this PR :
- introduces a new feature called `manage_rule_settings` feature for
rule SOs in the alerting framework based on the previous PR.
- fixes the issue where users with `alerting.rule.all` will always have
all permissions of subfeatures even when they are explicitly toggled off
through the Kibana Security role management UI.
This is done by extracting the new alerting features from
`alerting.rule.all` into their own features. This triggers a change in
all existing Kibana features that previously included
`alerting.rule.all` since now we will have to explicitly add `enable`,
`manual_run` and `manage_rule_settings` in those places.

# How was this tested?
I put these commits on top of my branch where I have the "Rules
management settings" sub feature which is using the alerting feature
provided in this PR.

## `manage_rule_settings`
I create a role with read only access to the rule feature and only this
sub feature enable. I am then able to create operate the gap fill
scheduler. See the video below 👇



https://github.com/user-attachments/assets/2bc285a4-d35a-412c-a9fd-2153fdec1b9e


## Issue with `alerting.rule.all`
I created a role that has all the permissions for rules, I toggled off
`enable` and then tried to reproduce the issue I previously recorded.


https://github.com/user-attachments/assets/42d47fbf-5dd0-47ff-8f04-2a8f1c0591f9

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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 Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants