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][Alerts] Alert (+Investigation) User Assignment (#2504) #170579

Merged
merged 125 commits into from
Dec 1, 2023

Conversation

e40pud
Copy link
Contributor

@e40pud e40pud commented Nov 3, 2023

Summary

With this PR we introduce a new Alert User Assignment feature:

  • It is possible to assign a user/s to alert/s
  • There is a new "Assignees" column in the alerts table which displays avatars of assigned users
  • There is a bulk action to update assignees for multiple alerts
  • It is possible to see and update assignees inside the alert details flyout component
  • There is an "Assignees" filter button on the Alerts page which allows to filter alerts by assignees

We decided to develop this feature on a separate branch. This gives us ability to make sure that it is thoroughly tested and we did not break anything in production. Since there is a data scheme changes involved we decided that it will be a better approach. cc @yctercero

Testing notes

In order to test assignments you need to create a few users. Then for users to appear in user profiles dropdown menu you need to activate them by login into those account at least once.

user-assignments-720.mov

Main ticket https://github.com/elastic/security-team/issues/2504

Bugfixes

Enhancements

Checklist

…he list of assigned users (#7647) (#166845)

## Summary

Closes elastic/security-team#7647

This PR extends alert's schema. We add a new field
`kibana.alert.workflow_assignee_ids` where assignees will live.
# Conflicts:
#	packages/kbn-alerts-as-data-utils/src/schemas/generated/alert_schema.ts
#	packages/kbn-alerts-as-data-utils/src/schemas/generated/security_schema.ts
# Conflicts:
#	x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_alerts/alert_assignees.cy.ts
…#169367)

## Summary

Fixes the bug where we would apply only visible user profile selections
instead of taking into account those which are not visible during the
search within component.
## Summary

Fix broken tests introduced in
#169367
… flyout component (#7662) (#169508)

## Summary

Closes elastic/security-team#7662

This PR adds Alert user assignment UI within alert's details flyout
component.


https://github.com/elastic/kibana/assets/2700761/b84299d7-5d65-4e9a-8836-807f51c0bbc7


This PR is a replacement to
#168467 since I broke that one
with wrong merges from main.

cc @PhilippeOberti
…gnments (#169534)

## Summary

A few fixes:
1. Broken test fix as a followup to
#169235
2. Make user profiles popover of a fixed size of 414px
…folder (#169645)

## Summary

These changes move user profiles hooks into a separate folder. Before it
was part of the `containers/detection_engine/alerts/`.
# Conflicts:
#	x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/flyout/index.tsx
@e40pud e40pud added ci:cloud-redeploy Always create a new Cloud deployment and removed ci:project-persist-deployment Persist project deployment indefinitely labels Nov 29, 2023
Copy link
Contributor

@marshallmain marshallmain left a comment

Choose a reason for hiding this comment

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

Started reviewing today but didn't get far, will finish tomorrow

# Conflicts:
#	x-pack/test/security_solution_cypress/cypress/tasks/navigation.ts
@e40pud e40pud removed the ci:cloud-redeploy Always create a new Cloud deployment label Nov 30, 2023
Copy link
Contributor

@marshallmain marshallmain left a comment

Choose a reason for hiding this comment

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

Looks pretty good overall - I think the assignees panel would benefit from some refactoring to make the data model and intended usage clearer.

Copy link
Contributor

@yctercero yctercero left a comment

Choose a reason for hiding this comment

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

Thank you for this huge effort, including a test plan, testing party and the automated tests.

Once #172285 is merged to add in the openAPI specs, I think it's good to go! Please ensure that one is merged in before merging this one. It looks like maybe there's some further component refactoring that is suggested. As long as @marshallmain is ok with it, I think the refactor can be followed up on.

Given the timezone differences, I'm going ahead and LGTM-ing.

## Summary

With these changes we specify the schemas for new alert assignments APIs
with OpenAPI.

cc @yctercero @marshallmain
# Conflicts:
#	x-pack/plugins/security_solution/server/routes/index.ts
@kibana-ci
Copy link
Collaborator

kibana-ci commented Dec 1, 2023

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 4738 4773 +35

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/rule-data-utils 113 114 +1

Async chunks

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

id before after diff
apm 3.7MB 3.7MB +50.0B
infra 1.9MB 1.9MB +50.0B
observability 1.1MB 1.1MB +50.0B
securitySolution 12.9MB 12.9MB +23.3KB
triggersActionsUi 1.4MB 1.4MB +254.0B
total +23.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
apm 36.6KB 36.7KB +68.0B
infra 103.0KB 103.0KB +68.0B
observability 100.0KB 100.1KB +68.0B
securitySolution 65.8KB 65.9KB +110.0B
securitySolutionEss 9.5KB 9.7KB +253.0B
triggersActionsUi 104.0KB 104.1KB +68.0B
total +635.0B
Unknown metric groups

API count

id before after diff
@kbn/rule-data-utils 116 117 +1

ESLint disabled line counts

id before after diff
securitySolution 464 463 -1

Total ESLint disabled count

id before after diff
securitySolution 534 533 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @e40pud

Copy link
Contributor

@marshallmain marshallmain left a comment

Choose a reason for hiding this comment

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

LGTM, component refactoring improvements to be done in a follow up

@e40pud e40pud merged commit 1ebdbc3 into main Dec 1, 2023
32 checks passed
@e40pud e40pud deleted the security/feature/alert-user-assignment branch December 1, 2023 15:26
@kibanamachine kibanamachine added v8.12.0 backport:skip This commit does not require backporting labels Dec 1, 2023
e40pud added a commit that referenced this pull request Dec 13, 2023
## Summary

With this changes I make "suggestions user profiles" API to be internal
instead of public. We did not reveal it via documentation and it is
better to mark it as an internal API.

This API was introduced in this PR
#170579 and was not released yet.

I also realised that currently the route does not reflect the fact that
it is finding user profiles:

`/api/detection_engine/signals/_find`

The new version will have `users` as part of the path:

`/internal/detection_engine/users/_find`
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 13, 2023
## Summary

With this changes I make "suggestions user profiles" API to be internal
instead of public. We did not reveal it via documentation and it is
better to mark it as an internal API.

This API was introduced in this PR
elastic#170579 and was not released yet.

I also realised that currently the route does not reflect the fact that
it is finding user profiles:

`/api/detection_engine/signals/_find`

The new version will have `users` as part of the path:

`/internal/detection_engine/users/_find`

(cherry picked from commit 7e168c7)
kibanamachine added a commit that referenced this pull request Dec 13, 2023
…173249)

# Backport

This will backport the following commits from `main` to `8.12`:
- [Switch "suggest user profiles" API to internal use
(#173141)](#173141)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-13T10:10:10Z","message":"Switch
\"suggest user profiles\" API to internal use (#173141)\n\n##
Summary\r\n\r\nWith this changes I make \"suggestions user profiles\"
API to be internal\r\ninstead of public. We did not reveal it via
documentation and it is\r\nbetter to mark it as an internal
API.\r\n\r\nThis API was introduced in this
PR\r\nhttps://github.com//pull/170579 and was not released
yet.\r\n\r\nI also realised that currently the route does not reflect
the fact that\r\nit is finding user
profiles:\r\n\r\n`/api/detection_engine/signals/_find`\r\n\r\nThe new
version will have `users` as part of the
path:\r\n\r\n`/internal/detection_engine/users/_find`","sha":"7e168c7fa9af17f80d3daa53a632754efb553c36","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:
SecuritySolution","backport:prev-minor","Team:Detection
Engine","v8.13.0"],"number":173141,"url":"https://github.com/elastic/kibana/pull/173141","mergeCommit":{"message":"Switch
\"suggest user profiles\" API to internal use (#173141)\n\n##
Summary\r\n\r\nWith this changes I make \"suggestions user profiles\"
API to be internal\r\ninstead of public. We did not reveal it via
documentation and it is\r\nbetter to mark it as an internal
API.\r\n\r\nThis API was introduced in this
PR\r\nhttps://github.com//pull/170579 and was not released
yet.\r\n\r\nI also realised that currently the route does not reflect
the fact that\r\nit is finding user
profiles:\r\n\r\n`/api/detection_engine/signals/_find`\r\n\r\nThe new
version will have `users` as part of the
path:\r\n\r\n`/internal/detection_engine/users/_find`","sha":"7e168c7fa9af17f80d3daa53a632754efb553c36"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173141","number":173141,"mergeCommit":{"message":"Switch
\"suggest user profiles\" API to internal use (#173141)\n\n##
Summary\r\n\r\nWith this changes I make \"suggestions user profiles\"
API to be internal\r\ninstead of public. We did not reveal it via
documentation and it is\r\nbetter to mark it as an internal
API.\r\n\r\nThis API was introduced in this
PR\r\nhttps://github.com//pull/170579 and was not released
yet.\r\n\r\nI also realised that currently the route does not reflect
the fact that\r\nit is finding user
profiles:\r\n\r\n`/api/detection_engine/signals/_find`\r\n\r\nThe new
version will have `users` as part of the
path:\r\n\r\n`/internal/detection_engine/users/_find`","sha":"7e168c7fa9af17f80d3daa53a632754efb553c36"}}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <[email protected]>
e40pud added a commit that referenced this pull request Feb 14, 2024
…o make the data model and intended usage clearer (#8164) (#176442)

## Summary

These changes are followup for [alert assignments
feature](elastic/security-team#2504) and
addresses feedback described in
elastic/security-team#8164

Addressed requests:
1. Clearer data model within filter
[filter_by_assignees.tsx](#170579 (comment))
2.
[Decouple](#170579 (comment))
`AssigneesApplyPanel` and `Apply` button

As part of this PR, I also fixed the issue where user was able to
trigger apply assignments action even when there were no changes done to
the list of assignees #173262.
Apply button will be disabled as long as there are no changes.


https://github.com/elastic/kibana/assets/2700761/45b02fb5-f85e-42d6-9411-5e040c99af68

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ESS 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5157)
- [Serverless 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5135)

---------

Co-authored-by: Kibana Machine <[email protected]>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…o make the data model and intended usage clearer (elastic#8164) (elastic#176442)

## Summary

These changes are followup for [alert assignments
feature](elastic/security-team#2504) and
addresses feedback described in
elastic/security-team#8164

Addressed requests:
1. Clearer data model within filter
[filter_by_assignees.tsx](elastic#170579 (comment))
2.
[Decouple](elastic#170579 (comment))
`AssigneesApplyPanel` and `Apply` button

As part of this PR, I also fixed the issue where user was able to
trigger apply assignments action even when there were no changes done to
the list of assignees elastic#173262.
Apply button will be disabled as long as there are no changes.


https://github.com/elastic/kibana/assets/2700761/45b02fb5-f85e-42d6-9411-5e040c99af68

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ESS 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5157)
- [Serverless 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5135)

---------

Co-authored-by: Kibana Machine <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
…o make the data model and intended usage clearer (elastic#8164) (elastic#176442)

## Summary

These changes are followup for [alert assignments
feature](elastic/security-team#2504) and
addresses feedback described in
elastic/security-team#8164

Addressed requests:
1. Clearer data model within filter
[filter_by_assignees.tsx](elastic#170579 (comment))
2.
[Decouple](elastic#170579 (comment))
`AssigneesApplyPanel` and `Apply` button

As part of this PR, I also fixed the issue where user was able to
trigger apply assignments action even when there were no changes done to
the list of assignees elastic#173262.
Apply button will be disabled as long as there are no changes.


https://github.com/elastic/kibana/assets/2700761/45b02fb5-f85e-42d6-9411-5e040c99af68

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ESS 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5157)
- [Serverless 97
times](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5135)

---------

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:cloud-deploy Create or update a Cloud deployment ci:cloud-persist-deployment Persist cloud deployment indefinitely release_note:feature Makes this part of the condensed release notes Team:Detection Engine Security Solution Detection Engine Area Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.