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] All the fields for all indices show when trying to add the a filters in a rule #179468

Closed
jsanz opened this issue Mar 26, 2024 · 21 comments
Assignees
Labels
8.16 candidate bug Fixes for quality problems that affect the customer experience Feature:Rule Creation Security Solution Detection Rule Creation workflow fixed impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Detection Engine Security Solution Detection Engine Area Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.15.4 v8.16.0 v9.0.0

Comments

@jsanz
Copy link
Member

jsanz commented Mar 26, 2024

Kibana version:
8.12.2

Original install method:
Cloud

Describe the bug:
When editing a security rule, the UI in the filter pill does not honor the index(es) that define the rule.

Steps to reproduce: (Original issue with index patterns, fixed in 8.13)

  1. Create a minimal new index
  2. Create a threshold security rule for that index
  3. Edit the rule and try to add a filter
  4. Fields for all indices show up instead of the fields from the rule index

Re-adding the index forces makes the UI to refresh and get just the fields from the defined index.

video with the index pattern bug
vokoscreenNG-2024-03-26_17-52-47.mp4

Steps to reproduce: (Issue with data views, present in 8.15)

  1. Create a minimal new index and corresponding data view
    PUT fields_index
    PUT fields_index/_mapping
    {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "field-1": {
          "type": "keyword"
        },
        "field-2": {
          "type": "keyword"
        },
        "field-3": {
          "type": "keyword"
        }
      }
    }
    
    POST fields_index/_doc
    {
     "@timestamp": "2024-10-01T09:26:30.425Z",
     "field-1": "test-0"
    }
  2. Create a security rule with that data view
  3. Edit the rule and try to add a filter
  4. Fields for all indices show up instead of the fields from the rule index
  5. Switching to indices and back to data view on rule form fixes issue
video with the Data view bug
Screen.Recording.2024-10-03.at.10.57.05.mov

Expected behavior:

Only the index/data view defined in the rule drives the fields showing up in the filter UI.

Screenshots (if relevant):

Errors in browser console (if relevant):
Nothing shows up

@jsanz jsanz added bug Fixes for quality problems that affect the customer experience Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. labels Mar 26, 2024
@elasticmachine
Copy link
Contributor

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

@MadameSheema MadameSheema added triage_needed Team:Detections and Resp Security Detection Response Team Team:Detection Engine Security Solution Detection Engine Area labels Mar 27, 2024
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Engine)

@jsanz
Copy link
Member Author

jsanz commented Mar 27, 2024

Seems to be fixed by #178207, but keeping it open for the team to confirm.

@shayfeld
Copy link

shayfeld commented Mar 27, 2024

Hi @jsanz ,

Is there any chance this problem can be resolved with index pattern and not with data view?

@jsanz
Copy link
Member Author

jsanz commented Mar 27, 2024

Is there any chance this problem can be resolved with index pattern and not with data view?

@shayfeld, I'm not sure what you mean here. Are you referring to the fix implemented at #178207 or something else?

@shayfeld
Copy link

shayfeld commented Mar 28, 2024

@jsanz ,
Yes , Because of the bug (#178207) in version 8.12, my rules work with index patterns as sources instead of data views. Is the bug in this ticket fixed with index patterns or only with data views as sources?

@nkhristinin
Copy link
Contributor

Hey @shayfeld, can you provide more details/examples about ?

my rules work with index patterns as sources instead of data views

@shayfeld
Copy link

shayfeld commented Mar 31, 2024

Hey @shayfeld, can you provide more details/examples about ?

my rules work with index patterns as sources instead of data views

As you can see in the link of create new rule, using Index patterns: winlogbeat-* as source of the rule. In 178207 they are using Data View as a source.
rule-query-example

@yctercero yctercero removed their assignment Apr 1, 2024
@yctercero yctercero added the Feature:Rule Creation Security Solution Detection Rule Creation workflow label Jun 5, 2024
@shayfeld
Copy link

Hi @jsanz @nkhristinin @yctercero ,

In v8.13.4, the bug still exists. I sent a video to the support team.

@yctercero
Copy link
Contributor

Thanks so much @shayfeld ! This is on our radar. We'll update the ticket as soon as we are able to take it up.

@yctercero yctercero added impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. 8.16 candidate labels Sep 28, 2024
@vitaliidm vitaliidm self-assigned this Sep 30, 2024
@vitaliidm
Copy link
Contributor

@shayfeld , @jsanz

I tried to reproduce the issue in 8.13.4, following the instructions in the ticket, but could not.
But issue is easily can be easily reproduced in 8.12.2 as reported in the issue

Issue reproduced in 8.12.2
Screen.Recording.2024-10-01.at.10.17.19.mov
Issue NOT reproduced in 8.13.4
Screen.Recording.2024-10-01.at.10.19.18.mov

What are the steps to reproduce it in 8.13.4? Is something missing in my approach?
Actions are identical in both videos, but for newer version, not issue found. It works as expected

@shayfeld
Copy link

shayfeld commented Oct 1, 2024

@vitaliidm ,

If you'd like, I can schedule a Zoom meeting for tomorrow to show you the steps I took.
Looking at the video again:

  1. Create rule with the dataview .kibana-event-logs* (contain index pattern .kibana-event-logs*)
  2. give it make 1 run (maybe it will help)
  3. Edit the rule and check if the filter showing other fields. (when I switch between dataview and index pattern, it works without the bug)

@vitaliidm
Copy link
Contributor

@shayfeld

So, I was able to reproduce the issue.

It does, in fact, fixed for indices, as in original ticket's description.
But your case is different, your rule is configured with Data view, not index.
When I reconfigured my rule, to use Data view, I was able to see the issue.

vitaliidm added a commit that referenced this issue Oct 9, 2024
…r all indices when trying to edit filters in a rule (#194678)

## Summary

 - addresses #179468
 - fixes issue when rule configured with Data view
 
**Steps to reproduce:**

1. Create a minimal new index and corresponding data view
    ```JSON
    PUT fields_index
    PUT fields_index/_mapping
    {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "field-1": {
          "type": "keyword"
        },
        "field-2": {
          "type": "keyword"
        },
        "field-3": {
          "type": "keyword"
        }
      }
    }
    
    POST fields_index/_doc
    {
     "@timestamp": "2024-10-01T09:26:30.425Z",
     "field-1": "test-0"
    }
    ```
2. Create a security rule with that data view
3. Edit the rule and try to add a filter
4. Fields for all indices show up instead of the fields from the rule
index
5. Switching to indices and back to data view on rule form fixes issue

<details>
<summary>video with the bug</summary>



https://github.com/user-attachments/assets/fc83356d-d727-4662-856e-a4f0b386b71f


</details>

### Additional benefit of fixing the issue.

Previously, there would be 2 additional field_caps requests, querying
ALL indices in ES, when rule edit page loads and rule configured with
data view.

```
http://localhost:5601/kbn/internal/data_views/fields?pattern=&meta_fields=_source&meta_fields=_id&meta_fields=_index&meta_fields=_score&meta_fields=_ignored&allow_no_index=true&apiVersion=1
```
Notice, there is `pattern=` query value, which results in querying all
existing indices
Now, these requests eliminated.


#### Before
<img width="2551" alt="Screenshot 2024-10-02 at 18 21 04"
src="https://github.com/user-attachments/assets/aa2b6acb-897d-488f-9ddd-409379c6b54a">


#### After

<img width="2557" alt="Screenshot 2024-10-02 at 18 22 41"
src="https://github.com/user-attachments/assets/baeeecda-bf16-4d37-ae07-3cdc136d18b4">
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Oct 9, 2024
…r all indices when trying to edit filters in a rule (elastic#194678)

## Summary

 - addresses elastic#179468
 - fixes issue when rule configured with Data view

**Steps to reproduce:**

1. Create a minimal new index and corresponding data view
    ```JSON
    PUT fields_index
    PUT fields_index/_mapping
    {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "field-1": {
          "type": "keyword"
        },
        "field-2": {
          "type": "keyword"
        },
        "field-3": {
          "type": "keyword"
        }
      }
    }

    POST fields_index/_doc
    {
     "@timestamp": "2024-10-01T09:26:30.425Z",
     "field-1": "test-0"
    }
    ```
2. Create a security rule with that data view
3. Edit the rule and try to add a filter
4. Fields for all indices show up instead of the fields from the rule
index
5. Switching to indices and back to data view on rule form fixes issue

<details>
<summary>video with the bug</summary>

https://github.com/user-attachments/assets/fc83356d-d727-4662-856e-a4f0b386b71f

</details>

### Additional benefit of fixing the issue.

Previously, there would be 2 additional field_caps requests, querying
ALL indices in ES, when rule edit page loads and rule configured with
data view.

```
http://localhost:5601/kbn/internal/data_views/fields?pattern=&meta_fields=_source&meta_fields=_id&meta_fields=_index&meta_fields=_score&meta_fields=_ignored&allow_no_index=true&apiVersion=1
```
Notice, there is `pattern=` query value, which results in querying all
existing indices
Now, these requests eliminated.

#### Before
<img width="2551" alt="Screenshot 2024-10-02 at 18 21 04"
src="https://github.com/user-attachments/assets/aa2b6acb-897d-488f-9ddd-409379c6b54a">

#### After

<img width="2557" alt="Screenshot 2024-10-02 at 18 22 41"
src="https://github.com/user-attachments/assets/baeeecda-bf16-4d37-ae07-3cdc136d18b4">

(cherry picked from commit 5a71d84)
@vitaliidm vitaliidm added the fixed label Oct 9, 2024
@vitaliidm
Copy link
Contributor

fixed in #194678

kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Oct 10, 2024
…r all indices when trying to edit filters in a rule (elastic#194678)

## Summary

 - addresses elastic#179468
 - fixes issue when rule configured with Data view

**Steps to reproduce:**

1. Create a minimal new index and corresponding data view
    ```JSON
    PUT fields_index
    PUT fields_index/_mapping
    {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "field-1": {
          "type": "keyword"
        },
        "field-2": {
          "type": "keyword"
        },
        "field-3": {
          "type": "keyword"
        }
      }
    }

    POST fields_index/_doc
    {
     "@timestamp": "2024-10-01T09:26:30.425Z",
     "field-1": "test-0"
    }
    ```
2. Create a security rule with that data view
3. Edit the rule and try to add a filter
4. Fields for all indices show up instead of the fields from the rule
index
5. Switching to indices and back to data view on rule form fixes issue

<details>
<summary>video with the bug</summary>

https://github.com/user-attachments/assets/fc83356d-d727-4662-856e-a4f0b386b71f

</details>

### Additional benefit of fixing the issue.

Previously, there would be 2 additional field_caps requests, querying
ALL indices in ES, when rule edit page loads and rule configured with
data view.

```
http://localhost:5601/kbn/internal/data_views/fields?pattern=&meta_fields=_source&meta_fields=_id&meta_fields=_index&meta_fields=_score&meta_fields=_ignored&allow_no_index=true&apiVersion=1
```
Notice, there is `pattern=` query value, which results in querying all
existing indices
Now, these requests eliminated.

#### Before
<img width="2551" alt="Screenshot 2024-10-02 at 18 21 04"
src="https://github.com/user-attachments/assets/aa2b6acb-897d-488f-9ddd-409379c6b54a">

#### After

<img width="2557" alt="Screenshot 2024-10-02 at 18 22 41"
src="https://github.com/user-attachments/assets/baeeecda-bf16-4d37-ae07-3cdc136d18b4">

(cherry picked from commit 5a71d84)
@MadameSheema
Copy link
Member

@pborgonovi 8.15.3 BC has been built already, please validate the fix and keep the ticket open until is validated in 8.16.0 BC, thanks!

@pborgonovi
Copy link
Contributor

pborgonovi commented Oct 15, 2024

Validated latest 8.15.3 BC and bug fix looks good:

Image

Screen.Recording.2024-10-11.at.11.37.06.AM.mov

Waiting to validate with 8.16 BC

@vitaliidm vitaliidm added v8.15.4 and removed v8.15.3 labels Oct 16, 2024
@vitaliidm
Copy link
Contributor

looks like this fix did not make to 8.15.3, despite PR being labeled as 8.15.3 by Kibana bot.
According to https://staging.elastic.co/8.15.3-82db83de/summary-8.15.3.html -
https://github.com/elastic/kibana/commits/3933429968aafb1ba31319fc38649d0f974044bf, 8.15.3 does not contain that fix.
I have relabelled it as 8.15.4. Not sure why it did not reproduce in your video. I as able consistently reproduce it

@pborgonovi
Copy link
Contributor

Thanks for the analysis @vitaliidm I'll make sure to validate 8.15.4 and 8.16 BC

cc @MadameSheema

@pborgonovi
Copy link
Contributor

Issue is fixed in 8.16.

Screen.Recording.2024-10-18.at.9.31.10.AM.mov

Waiting to validate with 8.15.4

@pborgonovi
Copy link
Contributor

Validated with 8.15.4 BC and fix looks good.

Creating new rule:

Screen.Recording.2024-11-05.at.2.38.33.PM.mov

Updating a rule:

Screen.Recording.2024-11-05.at.2.39.49.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.16 candidate bug Fixes for quality problems that affect the customer experience Feature:Rule Creation Security Solution Detection Rule Creation workflow fixed impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Detection Engine Security Solution Detection Engine Area Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.15.4 v8.16.0 v9.0.0
Projects
None yet
Development

No branches or pull requests

8 participants