-
Notifications
You must be signed in to change notification settings - Fork 444
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
adding zerofox integration #971
Conversation
💚 CLA has been signed |
@marc-gr - i just signed the contributor agreement |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is looking good! 🎉
Some of the fields under zerofox
that could be mapped to ECS fields, and maybe would be nice to have some extra test logs to see some of the empty fields in use. LMK if you need any help to move forward.
packages/zerofox/data_stream/alerts/_dev/test/pipeline/test-alert.json-expected.json
Outdated
Show resolved
Hide resolved
packages/zerofox/data_stream/alerts/_dev/test/pipeline/test-alert.json-expected.json
Outdated
Show resolved
Hide resolved
packages/zerofox/data_stream/alerts/_dev/test/pipeline/test-alert.json-expected.json
Outdated
Show resolved
Hide resolved
hey @zf-jedmunds ! Thanks for the changes. One thing I noticed in your pipeline is that the majority of it is dedicated to renaming fields from ---
description: Pipeline for parsing zerofox alerts
processors:
- set:
field: event.ingested
value: '{{_ingest.timestamp}}'
- set:
field: ecs.version
value: 1.9.0
- rename:
field: message
target_field: event.original
- json:
field: event.original
target_field: zerofox
- set:
field: zerofox.severity
value: info
if: ctx?.zerofox?.severity == 1
- set:
field: zerofox.severity
value: low
if: ctx?.zerofox?.severity == 2
- set:
field: zerofox.severity
value: medium
if: ctx?.zerofox?.severity == 3
- set:
field: zerofox.severity
value: high
if: ctx?.zerofox?.severity == 4
- set:
field: zerofox.severity
value: critical
if: ctx?.zerofox?.severity == 5
- convert:
field: zerofox.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.asset_term.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.entity.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.entity.entity_group.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.entity_term.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.perpetrator.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.rule_id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.rule_group_id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.asset.id
type: string
ignore_missing: true
ignore_failure: true
- convert:
field: zerofox.asset.entity_group.id
type: string
ignore_missing: true
ignore_failure: true
- json:
field: zerofox.metadata
ignore_failure: true
## Cleanup.
- remove:
field:
- zerofox.logs
- zerofox.entered_by
- zerofox.asset_term
- zerofox.entity_term
- zerofox.business_network
- zerofox.entity_email_receiver_id
ignore_missing: true
ignore_failure: true
- script:
description: Remove all empty values from zerofox.perpetrator.
lang: painless
if: ctx?.zerofox?.perpetrator != null
source: ctx.zerofox.perpetrator?.entrySet().removeIf(entry -> entry.getValue() == null || entry.getValue().equals("") || (entry.getValue() instanceof List && entry.getValue().length == 0) || (entry.getValue() instanceof Map && entry.getValue().size() == 0));
- script:
description: Remove all empty values from zerofox.metadata.
lang: painless
if: ctx?.zerofox?.metadata != null
source: ctx?.zerofox?.metadata?.entrySet().removeIf(entry -> entry.getValue() == null || entry.getValue().equals("") || (entry.getValue() instanceof List && entry.getValue().length == 0) || (entry.getValue() instanceof Map && entry.getValue().size() == 0));
- script:
description: Remove all empty values from zerofox.
lang: painless
if: ctx?.zerofox != null
source: ctx?.zerofox?.entrySet().removeIf(entry -> entry.getValue() == null || entry.getValue().equals("") || (entry.getValue() instanceof List && entry.getValue().length == 0) || (entry.getValue() instanceof Map && entry.getValue().size() == 0));
on_failure:
- set:
field: error.message
value: "{{ _ingest.on_failure_message }}" Please take a look and feel free to change anything you need in case I messed it up :) If you end up using it remember to re-generate the test golden files. On top of that, would be nice if some ECS mappings could be done and just keep under the Thanks for the work! |
/test |
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
/test |
/test |
* adding zerofox integration * updated changelog, more test data, remove null fields * metadata in test-alert.json * new fields + mappings + tests * metadata to flattened * pipeline suggestions from marc * rename ZeroFOX to ZeroFox, add ecs mappings * merge in marc-gr updates * Update packages/zerofox/manifest.yml Co-authored-by: Marc Guasch <marc-gr@users.noreply.github.com>
Enhancement
Integration to the ZeroFOX alerts API
Screenshots