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

[RAC][Security Solution][Observability] Add the add to new case and add to existing case actions to observability alerts table #108502

Merged
merged 6 commits into from
Aug 15, 2021

Conversation

kqualters-elastic
Copy link
Contributor

@kqualters-elastic kqualters-elastic commented Aug 13, 2021

Summary

This pr adds the add to new case and add to existing case actions to the observability alerts table. Some unused code in the observability alerts table is removed, and components refactored to prevent needless re-rendering. Observability alerts do not make as much use of ECS as security solution alerts do, and so some changes were made to pass the entire alert event as props instead of just the ECS fields as before.

add_to_existing_case_obs
add_to_new_case_obs

Checklist

Delete any items that are not applicable to this PR.

@kqualters-elastic kqualters-elastic added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Theme: rac label obsolete Feature:RAC label obsolete v7.15.0 Feature:Observability RAC labels Aug 13, 2021
@kqualters-elastic kqualters-elastic changed the title [RAC][Security Solution][Observability] [RAC][Security Solution][Observability] Add the add to new case and add to existing case actions to observability alerts table Aug 13, 2021
@kqualters-elastic kqualters-elastic marked this pull request as ready for review August 13, 2021 16:17
@kqualters-elastic kqualters-elastic requested review from a team as code owners August 13, 2021 16:17
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@mdefazio
Copy link
Contributor

This looks good! X-Posting for visibility...

Not sure if this will be in this PR or not, but bulk menu should also expose all the menu options and avoid nesting.
image

</EuiFlexItem>
<EuiFlexItem>
<EuiPopover
id="contextMenuExample"
Copy link
Contributor

@michaelolo24 michaelolo24 Aug 14, 2021

Choose a reason for hiding this comment

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

we prob want to change this at some point 😁

const isAlert = useMemo(() => {
if (event !== undefined) {
const data = [...event.data];
return data.some(({ field }) => field === 'kibana.alert.uuid');
Copy link
Contributor

Choose a reason for hiding this comment

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

Given all the changes going on, we should use the constant from @kbn/rule-data-utils

notifications: { toasts },
} = useKibana<TimelinesStartServices>().services;

const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const openPopover = useCallback(() => setIsPopoverOpen(true), []);
const closePopover = useCallback(() => setIsPopoverOpen(false), []);
const isEventSupported = !isEmpty(ecsRowData.signal?.rule?.id);
const isAlert = useMemo(() => {
if (event !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could event ever be null?

}
}, [event]);
const isSecurityAlert = useMemo(() => {
return !isEmpty(event?.ecs.signal?.rule?.id);
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't always be true as signal will eventually go away in place of kibana.alert. We probably want to check `event?.ecs['ALERT_RULE_PRODUCER'] here. @yctercero or @dhurley14 can confirm

});
const caseDetailsUrl = getCaseDetailsUrl({ id });
const appUrl = getUrlForApp(appId);
const fullCaseUrl = `${appUrl}/cases/${caseDetailsUrl}`;
Copy link
Contributor

@michaelolo24 michaelolo24 Aug 14, 2021

Choose a reason for hiding this comment

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

We may run into issues in the future if the url path is ever changed here. We should probably try and still have it all encapsulated as much as possible

props: AddToCaseActionProps,
{ store, storage, setStore }: { store: Store; storage: Storage; setStore: (store: Store) => void }
) => {
let tGridStore = store;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put this in a util like this to re-use across all these calls?

	const initializeMissingStore = (store, setStore) => {
	  let tGridStore = store;
	  if (!tGridStore) {
	      tGridStore = createStore(initialTGridState, storage);
	      setStore(tGridStore);
	    }
	}

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Pulled it down and tested locally and all was working well. Alerts in cases may still turned off in Observability detailing why we don't seem them in the created case at the moment, but I was able to create a case in Observability successfully. I made some nit comments in the code, but nothing too crazy. Spoke with @kqualters-elastic separately, and we'll address these changes in a follow up PR. Merging to make sure Observability has time to test it on their end at the start of the week.

@kqualters-elastic
Copy link
Contributor Author

@elasticmachine merge upstream

@kqualters-elastic kqualters-elastic enabled auto-merge (squash) August 15, 2021 16:50
@kibanamachine
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
observability 480.7KB 483.6KB +2.9KB
securitySolution 6.5MB 6.5MB +48.0B
timelines 391.8KB 400.2KB +8.5KB
total +11.4KB

Page load bundle

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

id before after diff
timelines 310.3KB 312.5KB +2.2KB
Unknown metric groups

API count

id before after diff
timelines 936 938 +2

API count missing comments

id before after diff
timelines 816 818 +2

Non-exported public API item count

id before after diff
timelines 26 25 -1

History

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

@kqualters-elastic kqualters-elastic merged commit 0828788 into elastic:master Aug 15, 2021
@kqualters-elastic kqualters-elastic deleted the add-to-case-obsv branch August 15, 2021 23:11
kqualters-elastic added a commit to kqualters-elastic/kibana that referenced this pull request Aug 16, 2021
…dd to existing case actions to observability alerts table (elastic#108502)

* [RAC][Security Solution][Observability] Add the add to new case and add to existing case actions to observability alerts table

* Remove fake data and make features work with observability data format

* Remove console.log and unused translations

* Remove commented out code

* Remove unneeded copy pasta id, create initializeStore function in timelines

Co-authored-by: Kibana Machine <[email protected]>
kqualters-elastic added a commit that referenced this pull request Aug 16, 2021
…dd to existing case actions to observability alerts table (#108502) (#108691)

* [RAC][Security Solution][Observability] Add the add to new case and add to existing case actions to observability alerts table

* Remove fake data and make features work with observability data format

* Remove console.log and unused translations

* Remove commented out code

* Remove unneeded copy pasta id, create initializeStore function in timelines

Co-authored-by: Kibana Machine <[email protected]>

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
Feature:Observability RAC Feature:RAC label obsolete release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Theme: rac label obsolete v7.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants