-
Notifications
You must be signed in to change notification settings - Fork 471
[Google Threat Intelligence] Add IOC Stream data stream #13449
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
base: main
Are you sure you want to change the base?
[Google Threat Intelligence] Add IOC Stream data stream #13449
Conversation
Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as |
…thub.com/niraj-crest/integrations into ti_google_threat_intelligence_ioc_stream
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
version: '2.3' | ||
services: | ||
ti_google_threat_intelligence: | ||
image: docker.elastic.co/observability/stream:v0.15.0 |
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.
image: docker.elastic.co/observability/stream:v0.15.0 | |
image: docker.elastic.co/observability/stream:v0.18.0 |
request( | ||
"GET", | ||
state.url.trim_right("/") + "/api/v3/ioc_stream?" + { | ||
"limit": ["40"], |
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.
Why is this hardcoded?
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.
Maximum Limit of endpoint,
We kept it hardcoded to reduce network calls.
"Header": { | ||
"x-apikey": [state.access_token], | ||
"x-tool": ["Elastic"], | ||
"User-Agent": ["v0.1.0"], // Include integration version here; used for identifying and monitoring requests |
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.
"User-Agent": ["v0.1.0"], // Include integration version here; used for identifying and monitoring requests | |
"User-Agent": ["v0.1.0"], // Keep this in sync with 'version' in package level manifest.yml. |
to maintain consistency with other data streams.
"last_timestamp": has(body.?meta.cursor) ? state.start_time : state.end_time, | ||
}, | ||
"want_more": has(body.?meta.cursor), | ||
"next_page": has(body.?meta.cursor) ? body.meta.cursor : null |
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.
"next_page": has(body.?meta.cursor) ? body.meta.cursor : null | |
"next": { | |
?"page": body.?meta.cursor, | |
"interval": interval, | |
}, |
Please don't use null
to indicate absence.
"events": ( has(body.data) && size(body.data) > 0 ? | ||
body.data.map(e, { | ||
"message": e.encode_json() | ||
}) | ||
: | ||
[{"message": "retry"}] |
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.
"events": ( has(body.data) && size(body.data) > 0 ? | |
body.data.map(e, { | |
"message": e.encode_json() | |
}) | |
: | |
[{"message": "retry"}] | |
"events": ( has(body.data) && size(body.data) > 0 ? | |
body.data.map(e, { | |
"message": e.encode_json() | |
}) | |
: | |
[{"message": "retry"}] |
- set: | ||
field: observer.vendor | ||
tag: set_observer_vendor | ||
value: Google | ||
- set: | ||
field: observer.product | ||
tag: set_observer_product | ||
value: Threat Intelligence |
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.
Can these be constant_keyword
?
- convert: | ||
field: json.attributes.asn | ||
tag: convert_attributes_asn_to_long | ||
target_field: gti.ioc_stream.attributes.asn | ||
type: long |
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.
Is this always safe? (ref) (same below)
if (ctx.threat == null) { | ||
ctx.threat = new HashMap(); | ||
} | ||
if (ctx.threat.indicator == null) { | ||
ctx.threat.indicator = new HashMap(); | ||
} |
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.
if (ctx.threat == null) { | |
ctx.threat = new HashMap(); | |
} | |
if (ctx.threat.indicator == null) { | |
ctx.threat.indicator = new HashMap(); | |
} | |
ctx.threat = ctx.thread ?: [:]; | |
ctx.threat.indicator = ctx.thread.indicator ?: [:]; |
- append: | ||
field: tags | ||
value: preserve_original_event | ||
allow_duplicates: false |
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.
Final new line.
- set: | ||
field: event.kind | ||
tag: set_pipeline_error_into_event_kind | ||
value: pipeline_error | ||
if: ctx.error?.message != null |
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.
Note discussion about this being an array?
What does this PR do?
Checklist
changelog.yml
file.How to test this PR locally