Skip to content

Conversation

@agmic
Copy link
Contributor

@agmic agmic commented Feb 27, 2024

Enhancement

Proposed commit message

Modify incident handling to match Defender for Endpoint.

  • Change fingerprint to use creation_time and modification_time to generate a unique id
  • Add event.created set to original incident creation time
  • Set timestamp to modification_time
  • Change search cursor to use modification_time instead of creation_time in order to only fetch newest incidents.
  • Add severity:critical=5 to allow for events marked as 5 in Cortex XDR

This change will align the integration with the defender for endpoint integration, enable correct fetching of the latest incidents and incident changes, and allow for ingestion of modified incidents.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
@agmic agmic requested a review from a team as a code owner February 27, 2024 14:06
@cla-checker-service
Copy link

cla-checker-service bot commented Feb 27, 2024

💚 CLA has been signed

@jamiehynds jamiehynds added Integration:panw_cortex_xdr Palo Alto Cortex XDR enhancement New feature or request Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Mar 4, 2024
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@jkomara
Copy link

jkomara commented Mar 5, 2024

buildkite test this

@agmic
Copy link
Contributor Author

agmic commented Mar 11, 2024

I see the build is failing, but don't have access to buildkite to see why. Is there anything I can help with to facilitate this?

@kcreddy
Copy link
Contributor

kcreddy commented Mar 22, 2024

@agmic CI is failing on this line inside changelog: link: https://github.com/elastic/integrations/pull/ with following error:
Error: checking package failed: linting package failed: found 1 validation error:   | 1. https://github.com/elastic/integrations/pull/: issue number in changelog link should be a positive number

Can you update the line to link: https://github.com/elastic/integrations/pull/9246?

@agmic
Copy link
Contributor Author

agmic commented Mar 26, 2024

thx @kcreddy . I've made the update - any last things needed to trigger the buildcheck?

@kcreddy
Copy link
Contributor

kcreddy commented Mar 26, 2024

/test

@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
No Duplication information No data about Duplication

See analysis details on SonarQube

@kcreddy
Copy link
Contributor

kcreddy commented Mar 26, 2024

Hey @agmic,
IIUC you are trying add support for ingesting modified incidents.
But the problem I see is that it gets difficult to analyse documents with dashboards/aggregations. For example, when an incident has changed its severity from critical to high, you will have 2 documents now inside the datastream with 2 states.
When you try to find how many incidents have severity: critical -> this leads to 1.
Also, how many incidents have severity: high -> this also leads to 1.

The better way to handle this is using Elasticsearch Latest Transform where you can store latest copy in separate index. But, transforms are usually computationally expensive as every time it has to query all the data in the source datastream to find and store latest copies.

@jamiehynds Do you think adding this support (modified incidents) using transforms is worth it? Currently based on the fingerprint processor, modifications to incidents are not ingested.

@agmic
Copy link
Contributor Author

agmic commented Mar 26, 2024

We find value in the suggested behavior as it allows the modifications to come into elastic, enabling us to follow the changes. The behavior also follows how incidents from M365 Defender are being handled by that integration.
I checked the M365 Incident dashboard, and it looks like it is just uses a simple filter on severity, so there is the potential for counting the same incident twice here as well. But I believe this could be handled by taking the last value of a given incident ID.

@botelastic
Copy link

botelastic bot commented Apr 25, 2024

Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Apr 25, 2024
@agmic
Copy link
Contributor Author

agmic commented Apr 29, 2024

👍

@botelastic botelastic bot removed the Stalled label Apr 29, 2024
@kcreddy kcreddy mentioned this pull request May 23, 2024
4 tasks
@botelastic
Copy link

botelastic bot commented May 29, 2024

Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label May 29, 2024
@andrewkroh
Copy link
Member

The update to include mod time in the fingerprint seem good, because otherwise the integration mostly won't index any updates. I suggest adding a small blurb in the Alerts section of the package's readme to state that a new document is indexed when alerts are modified.

@botelastic botelastic bot removed the Stalled label May 30, 2024
Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

Hey @agmic , if you are okay with the suggestion here, could you please add to this PR?

As for the other approach, if you would like to add latest transform, you can take an example from here.

@agmic
Copy link
Contributor Author

agmic commented Jul 9, 2024

@kcreddy I'll update the readme and add it to the PR. Just to be clear, I'll add it to the Incidents section, as this is what is changed.
Since there have been changes to the cortex integration since my initial PR (we are now on version 1.27.0) Do I need to resolve the conflicts and resubmit all changes - or can I just change the readme file?

@kcreddy
Copy link
Contributor

kcreddy commented Jul 9, 2024

Hey @agmic, thanks for taking care of this.

Just to be clear, I'll add it to the Incidents section, as this is what is changed.

Yes, that sounds good.

Do I need to resolve the conflicts and resubmit all changes - or can I just change the readme file?

Yes, the merge conflicts need to be resolved as well.

@agmic agmic requested a review from kcreddy July 11, 2024 06:47
@kcreddy
Copy link
Contributor

kcreddy commented Jul 11, 2024

/test

Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

@agmic The CI is failing on outdated README.
Can you regenerate the README file and commit it.

elastic-package build && elastic-package format && elastic-package lint && elastic-package check && elastic-package build

agmic added 3 commits July 11, 2024 15:41
Add blurb explaining that a new incident document is indexed upon incident modification to README.md template
Update version of README.md as generated by elastic-package
@agmic
Copy link
Contributor Author

agmic commented Jul 11, 2024

@kcreddy - I'd forgotten that the README.md was generated from a template. I've modified the template in _dev/build/docs and run the elastic-package commands above. The regenerated README.md appears to be unchanged.

@agmic agmic requested a review from kcreddy July 12, 2024 06:42
@kcreddy
Copy link
Contributor

kcreddy commented Jul 12, 2024

/test

@agmic
Copy link
Contributor Author

agmic commented Jul 12, 2024

@kcreddy Failing on expected outcome of incident parsing due to change of timestamp handling - I'll get that remedied.

@kcreddy
Copy link
Contributor

kcreddy commented Jul 12, 2024

/test

@kcreddy
Copy link
Contributor

kcreddy commented Jul 12, 2024

@agmic You may have to re-run the pipeline tests:
eval "$(elastic-package stack shellinit)" && elastic-package test pipeline --generate -v

There is a missing comma , in one of the lines, causing an invalid JSON.

@agmic
Copy link
Contributor Author

agmic commented Jul 12, 2024

/test

1 similar comment
@kcreddy
Copy link
Contributor

kcreddy commented Jul 12, 2024

/test

@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

💚 Build Succeeded

History

Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

LGTM

@kcreddy kcreddy merged commit 7e91851 into elastic:main Jul 12, 2024
@elasticmachine
Copy link

Package panw_cortex_xdr - 1.28.0 containing this change is available at https://epr.elastic.co/search?package=panw_cortex_xdr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Integration:panw_cortex_xdr Palo Alto Cortex XDR Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

6 participants