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 Solution] Bulk actions and Custom rules got disabled when custom user have "NONE" access of actions and connectors. #141050

Open
Tracked by #151924
ghost opened this issue Sep 20, 2022 · 6 comments
Labels
bug Fixes for quality problems that affect the customer experience Feature:Rule Details Security Solution Detection Rule Details page Feature:Rule Management Security Solution Detection Rule Management area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. 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.

Comments

@ghost
Copy link

ghost commented Sep 20, 2022

Describe the bug:
Bulk actions and Custom rules got disabled when custom user have "NONE" access of actions and connectors.

Build Details:

VERSION: 8.5.0 Snapshot
BUILD: 56410
COMMIT: 189196181c975b620ab18ea9d7662aa38d0e9294

Preconditions:

  1. Elasticsearch should be up and running
  2. Kibana should be up and running
  3. Custom rules should be created with actions.

Steps to Reproduce:

  1. Navigate to Stack management --> Roles.
  2. Create a Role with below configurations:

image

Annotation 2022-09-20 160407

  1. Navigate to Stack management-->Users.
  2. Create custom User and assign above created role.
  3. Login with a custom user.
  4. Navigate to Security-->Manage-->Rules.
  5. Select the above custom created rules.
  6. Click on "Bulk Actions"

Expected Result:
Bulk actions should be enabled and rule also should be enabled.

Actual Result:
Bulk actions and rule are disabled.

Screenshots:
Annotation 2022-09-20 161316

@ghost ghost added bug Fixes for quality problems that affect the customer experience triage_needed impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team v8.5.0 labels Sep 20, 2022
@ghost ghost self-assigned this Sep 20, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@ghost ghost assigned MadameSheema and unassigned ghost Sep 20, 2022
@MadameSheema MadameSheema added the Team:Detections and Resp Security Detection Response Team label Sep 21, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@banderror
Copy link
Contributor

Great catch @karanverma-qasource, thank you! Some other observations made under a user with the mentioned privileges:

Enable/disable switch is disabled on the Details page because You do not have Kibana Actions privileges. This is probably expected behavior (if so, on the Rules page it would be expected too):

Screenshot 2022-09-26 at 13 48 30

The Edit rule settings button is disabled because You do not have Kibana Actions privileges. This looks like a bug - I'd expect the user to still be able to edit other fields:

Screenshot 2022-09-26 at 13 48 51

A rule without any actions can't be enabled/disabled from the Details page, while can be from the Rules page:

Screenshot 2022-09-26 at 13 54 05

Screenshot 2022-09-26 at 13 54 58

@banderror banderror added Feature:Rule Management Security Solution Detection Rule Management area Feature:Rule Details Security Solution Detection Rule Details page and removed triage_needed v8.5.0 labels Sep 26, 2022
@banderror banderror removed their assignment Sep 26, 2022
@banderror
Copy link
Contributor

banderror commented Oct 21, 2022

As we figured out with @XavierM, the root cause of this bug is related to Alerting Framework's RBAC.

In particular, it relates to the fact that Alerting Framework updates the API key of a rule on every rule modification (except enable/disable since 8.3 (#131581)). The regenerated API key corresponds to the user that initiated this rule modification. In turn, if this user has different privileges than the user that this rule was associated with before the modification, this can lead to unintended consequences:

  • After the modification, the rule may get more privileges than before (e.g. it may get access to new indices) which can cause more (unintended) alerts to be generated
  • After the modification, the rule may get less privileges than before (e.g. it may lose access to some indices) which can cause fewer alerts to be generated

Now, this specific UI behavior looks to be intentional. We disable all the bulk actions and also single actions if the user doesn't have Actions and Connectors privileges, because if this user modifies any rule which happens to have any actions, these actions will start failing during their execution (they will be executed on behalf of this user that doesn't have the required privileges to run actions).

We could try to add more checks to our code and handle some of the cases on our side, but it would be workarounds that we decided not to introduce at this point.

We should instead address the fundamental problem with API keys on the Framework side, e.g. execute rules on behalf of service accounts instead of user accounts, so that user modifications don't change the rules' privileges.

UPD: mentioned that since 8.3 enabling or disabling a rule does not regenerate the rule's API key: #131581

@sophiec20
Copy link
Contributor

Since 8.3, I believe you can bulk enable / disable rules without it regenerating the API Key. However if no API Key exists, for example directly after a bulk import of new disabled rules, then one will be assigned the first time the rule is enabled.

It is existing behaviour that the API Key will be regenerated on every rule edit and the ability to edit rules is expected to be restricted to users who are also authorized to execute them.

Use of "Service Accounts" is appealing, however this is a larger piece of work as it also requires the ability to manage, maintain and audit service accounts. This would be a useful platform feature and not limited to rule execution. There are several areas discussing this but afaik this is not yet in development. (cc @bytebilly for visibility)

In the short term, it would be advisable to limit the ability to edit rules to users who are also authorised to execute them. -- the comment above seems to contradict this wrt to bulk disable/enable. Is this a regression?

@banderror
Copy link
Contributor

Since 8.3, I believe you can bulk enable / disable rules without it regenerating the API Key. However if no API Key exists, for example directly after a bulk import of new disabled rules, then one will be assigned the first time the rule is enabled.
the comment above seems to contradict this wrt to bulk disable/enable. Is this a regression?

@sophiec20 Oh, I was not aware of the improvement made in 8.3. That's great! I don't think we have a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Rule Details Security Solution Detection Rule Details page Feature:Rule Management Security Solution Detection Rule Management area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. 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.
Projects
None yet
Development

No branches or pull requests

4 participants