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] Add AlertSuppression and Investigation Fields to Rule Upgrade workflow #195499

Conversation

jpdjere
Copy link
Contributor

@jpdjere jpdjere commented Oct 8, 2024

Resolves: #190597

Summary

Adds AlertSuppression and Investigation Fields to Rule Upgrade workflow:

Screenshots

Investigation Fields

image

Alert Suppression

image

Testing

Little bit tricky: no prebuilt rules have these fields, so no matter which packages you install you wont' see this upgrade. You'll need to tinker with the security-rule assets, for example:

POST .kibana_security_solution/_update_by_query
{
  "script": {
    "source": """
        ctx._source['security-rule']['alert_suppression'] = [
        'group_by': ['agent.hostname'],
        'missing_fields_strategy': 'suppress'
      ];
    """,
    "lang": "painless"
  },
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "type": {
              "value": "security-rule"
            }
          }
        },
        {
          "term": {
            "security-rule.rule_id": {
              "value": "0564fb9d-90b9-4234-a411-82a546dc1343"
            }
          }
        },
        {
          "term": {
            "security-rule.version": {
              "value": "111"
            }
          }
        }
      ]
    }
  }
}

For maintainers

@jpdjere jpdjere self-assigned this Oct 8, 2024
@jpdjere jpdjere added release_note:enhancement Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Oct 8, 2024
@jpdjere jpdjere marked this pull request as ready for review October 8, 2024 19:56
@jpdjere jpdjere requested a review from a team as a code owner October 8, 2024 19:56
@jpdjere jpdjere requested a review from maximpn October 8, 2024 19:56
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 20.6MB 20.6MB +215.0B

History

cc @jpdjere

Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

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

LGTM

@jpdjere jpdjere merged commit ed144bd into elastic:main Oct 11, 2024
45 checks passed
@jpdjere jpdjere deleted the add-investigation-fields-and-alert-suppression-tp-upgrade-workflow branch October 11, 2024 13:44
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11293508837

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 11, 2024
… to Rule Upgrade workflow (elastic#195499)

Resolves: elastic#190597

## Summary

Adds `AlertSuppression` and `Investigation Fields` to Rule Upgrade
workflow:
- Fields had already been added to DiffableRule schema and diffing
algorithms in elastic#190128
- Current PR adds them to the UI field list so they get displayed in the
diff

## Screenshots

#### Investigation Fields

![image](https://github.com/user-attachments/assets/bff90832-cbf7-4804-888f-b62db5d08127)

#### Alert Suppression

![image](https://github.com/user-attachments/assets/a46fc2db-53d1-4aab-92fc-c92ff88a60b0)

## Testing

Little bit tricky: no prebuilt rules have these fields, so no matter
which packages you install you wont' see this upgrade. You'll need to
tinker with the security-rule assets, for example:
```ts
POST .kibana_security_solution/_update_by_query
{
  "script": {
    "source": """
        ctx._source['security-rule']['alert_suppression'] = [
        'group_by': ['agent.hostname'],
        'missing_fields_strategy': 'suppress'
      ];
    """,
    "lang": "painless"
  },
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "type": {
              "value": "security-rule"
            }
          }
        },
        {
          "term": {
            "security-rule.rule_id": {
              "value": "0564fb9d-90b9-4234-a411-82a546dc1343"
            }
          }
        },
        {
          "term": {
            "security-rule.version": {
              "value": "111"
            }
          }
        }
      ]
    }
  }
}
```

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit ed144bd)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 11, 2024
…Investigation Fields` to Rule Upgrade workflow (#195499) (#195924)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Add `AlertSuppression` and
`Investigation Fields` to Rule Upgrade workflow
(#195499)](#195499)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Juan Pablo
Djeredjian","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-11T13:44:50Z","message":"[Security
Solution] Add `AlertSuppression` and `Investigation Fields` to Rule
Upgrade workflow (#195499)\n\nResolves:
https://github.com/elastic/kibana/issues/190597\r\n\r\n##
Summary\r\n\r\nAdds `AlertSuppression` and `Investigation Fields` to
Rule Upgrade\r\nworkflow:\r\n- Fields had already been added to
DiffableRule schema and diffing\r\nalgorithms in
https://github.com/elastic/kibana/pull/190128\r\n- Current PR adds them
to the UI field list so they get displayed in the\r\ndiff\r\n\r\n##
Screenshots\r\n\r\n#### Investigation
Fields\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/bff90832-cbf7-4804-888f-b62db5d08127)\r\n\r\n####
Alert
Suppression\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/a46fc2db-53d1-4aab-92fc-c92ff88a60b0)\r\n\r\n\r\n##
Testing\r\n\r\nLittle bit tricky: no prebuilt rules have these fields,
so no matter\r\nwhich packages you install you wont' see this upgrade.
You'll need to\r\ntinker with the security-rule assets, for
example:\r\n```ts\r\nPOST
.kibana_security_solution/_update_by_query\r\n{\r\n \"script\": {\r\n
\"source\": \"\"\"\r\n ctx._source['security-rule']['alert_suppression']
= [\r\n 'group_by': ['agent.hostname'],\r\n 'missing_fields_strategy':
'suppress'\r\n ];\r\n \"\"\",\r\n \"lang\": \"painless\"\r\n },\r\n
\"query\": {\r\n \"bool\": {\r\n \"must\": [\r\n {\r\n \"term\": {\r\n
\"type\": {\r\n \"value\": \"security-rule\"\r\n }\r\n }\r\n },\r\n
{\r\n \"term\": {\r\n \"security-rule.rule_id\": {\r\n \"value\":
\"0564fb9d-90b9-4234-a411-82a546dc1343\"\r\n }\r\n }\r\n },\r\n {\r\n
\"term\": {\r\n \"security-rule.version\": {\r\n \"value\": \"111\"\r\n
}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ed144bdba48585754de6b89f80b5dbba37f19edf","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","Feature:Prebuilt Detection
Rules","backport:prev-minor","v8.16.0"],"title":"[Security Solution] Add
`AlertSuppression` and `Investigation Fields` to Rule Upgrade
workflow","number":195499,"url":"https://github.com/elastic/kibana/pull/195499","mergeCommit":{"message":"[Security
Solution] Add `AlertSuppression` and `Investigation Fields` to Rule
Upgrade workflow (#195499)\n\nResolves:
https://github.com/elastic/kibana/issues/190597\r\n\r\n##
Summary\r\n\r\nAdds `AlertSuppression` and `Investigation Fields` to
Rule Upgrade\r\nworkflow:\r\n- Fields had already been added to
DiffableRule schema and diffing\r\nalgorithms in
https://github.com/elastic/kibana/pull/190128\r\n- Current PR adds them
to the UI field list so they get displayed in the\r\ndiff\r\n\r\n##
Screenshots\r\n\r\n#### Investigation
Fields\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/bff90832-cbf7-4804-888f-b62db5d08127)\r\n\r\n####
Alert
Suppression\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/a46fc2db-53d1-4aab-92fc-c92ff88a60b0)\r\n\r\n\r\n##
Testing\r\n\r\nLittle bit tricky: no prebuilt rules have these fields,
so no matter\r\nwhich packages you install you wont' see this upgrade.
You'll need to\r\ntinker with the security-rule assets, for
example:\r\n```ts\r\nPOST
.kibana_security_solution/_update_by_query\r\n{\r\n \"script\": {\r\n
\"source\": \"\"\"\r\n ctx._source['security-rule']['alert_suppression']
= [\r\n 'group_by': ['agent.hostname'],\r\n 'missing_fields_strategy':
'suppress'\r\n ];\r\n \"\"\",\r\n \"lang\": \"painless\"\r\n },\r\n
\"query\": {\r\n \"bool\": {\r\n \"must\": [\r\n {\r\n \"term\": {\r\n
\"type\": {\r\n \"value\": \"security-rule\"\r\n }\r\n }\r\n },\r\n
{\r\n \"term\": {\r\n \"security-rule.rule_id\": {\r\n \"value\":
\"0564fb9d-90b9-4234-a411-82a546dc1343\"\r\n }\r\n }\r\n },\r\n {\r\n
\"term\": {\r\n \"security-rule.version\": {\r\n \"value\": \"111\"\r\n
}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ed144bdba48585754de6b89f80b5dbba37f19edf"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195499","number":195499,"mergeCommit":{"message":"[Security
Solution] Add `AlertSuppression` and `Investigation Fields` to Rule
Upgrade workflow (#195499)\n\nResolves:
https://github.com/elastic/kibana/issues/190597\r\n\r\n##
Summary\r\n\r\nAdds `AlertSuppression` and `Investigation Fields` to
Rule Upgrade\r\nworkflow:\r\n- Fields had already been added to
DiffableRule schema and diffing\r\nalgorithms in
https://github.com/elastic/kibana/pull/190128\r\n- Current PR adds them
to the UI field list so they get displayed in the\r\ndiff\r\n\r\n##
Screenshots\r\n\r\n#### Investigation
Fields\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/bff90832-cbf7-4804-888f-b62db5d08127)\r\n\r\n####
Alert
Suppression\r\n\r\n\r\n![image](https://github.com/user-attachments/assets/a46fc2db-53d1-4aab-92fc-c92ff88a60b0)\r\n\r\n\r\n##
Testing\r\n\r\nLittle bit tricky: no prebuilt rules have these fields,
so no matter\r\nwhich packages you install you wont' see this upgrade.
You'll need to\r\ntinker with the security-rule assets, for
example:\r\n```ts\r\nPOST
.kibana_security_solution/_update_by_query\r\n{\r\n \"script\": {\r\n
\"source\": \"\"\"\r\n ctx._source['security-rule']['alert_suppression']
= [\r\n 'group_by': ['agent.hostname'],\r\n 'missing_fields_strategy':
'suppress'\r\n ];\r\n \"\"\",\r\n \"lang\": \"painless\"\r\n },\r\n
\"query\": {\r\n \"bool\": {\r\n \"must\": [\r\n {\r\n \"term\": {\r\n
\"type\": {\r\n \"value\": \"security-rule\"\r\n }\r\n }\r\n },\r\n
{\r\n \"term\": {\r\n \"security-rule.rule_id\": {\r\n \"value\":
\"0564fb9d-90b9-4234-a411-82a546dc1343\"\r\n }\r\n }\r\n },\r\n {\r\n
\"term\": {\r\n \"security-rule.version\": {\r\n \"value\": \"111\"\r\n
}\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n}\r\n```\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"ed144bdba48585754de6b89f80b5dbba37f19edf"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Juan Pablo Djeredjian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules area release_note:enhancement 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. v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution] Add InvestigationFields and AlertSuppression fields to the upgrade workflow
4 participants