-
Notifications
You must be signed in to change notification settings - Fork 472
[Google Threat Intelligence] Add Integration Package #13189
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
[Google Threat Intelligence] Add Integration Package #13189
Conversation
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
Hey @jamiehynds & @andrewkroh |
/test |
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.
@niraj-crest, could you fix the CI error?
Error: there is no owner for "packages/ti_google_threat_intelligence" in ".github/CODEOWNERS"
by adding a line into .github/CODEOWNERS
0078531
to
1b3d6dd
Compare
Hello @kcreddy, |
/test |
🚀 Benchmarks reportTo see the full report comment with |
@niraj-crest, looks like the PR is failing Can you re-sync your branch with elastic:main? |
Done @kcreddy. |
@niraj-crest, I don't think its done. ![]() |
/test |
|
Hello @kcreddy, |
...elligence/data_stream/first_stage_delivery_vectors/elasticsearch/ingest_pipeline/default.yml
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
@niraj-crest I've added few comments. I haven't looked into the entire PR yet. Will do. |
packages/ti_google_threat_intelligence/_dev/deploy/docker/files/config.yml
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
...google_threat_intelligence/data_stream/cryptominer/elasticsearch/ingest_pipeline/default.yml
Outdated
Show resolved
Hide resolved
...t_intelligence/data_stream/cryptominer/_dev/test/pipeline/test-cryptominer.log-expected.json
Show resolved
Hide resolved
...t_intelligence/data_stream/cryptominer/_dev/test/pipeline/test-cryptominer.log-expected.json
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/elasticsearch/transform/domain_ioc/transform.yml
Outdated
Show resolved
Hide resolved
/test |
Hello @kcreddy / @efd6 /@andrewkroh |
state.with({ | ||
"start_time": state.?cursor.last_timestamp.orValue((now - duration(state.initial_interval)).format("2006010215")) | ||
}).as(state, state.with( |
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.
state.with({ | |
"start_time": state.?cursor.last_timestamp.orValue((now - duration(state.initial_interval)).format("2006010215")) | |
}).as(state, state.with( | |
state.?cursor.last_timestamp.orValue((now - duration(state.initial_interval)).format("2006010215")).as(start_time, |
since this is overwritten for every eval it doesn't need to be put in state
. This will need bracket fixups.
Though, I would also reconsider doing the format here. Instead, that way you don't need to reparse each time you make an adjustment.
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.
Thank you for the suggestion!
We’ve updated the code to use start_time
directly as recommended, which definitely helped simplify things.
Regarding your additional point about reconsidering the formatting, we explored that approach but ran into a timing issue due to the API's behavior. Specifically, the API enforces a 1-hour delay, and if we don’t round precisely to the hour, we risk calling a future window too early.
For example, if the current time is 10:21
and we start with an initial interval of 2h
, we’ll fetch data for 08
and 09
. When checking whether to proceed to the next hour, (09:21 + 1h)
becomes 10:21
, which might still be less than now (say 10:22
) by the time the check happens. This leads us to attempt a 10:00
call prematurely and receive an error.
To avoid this, we’ve kept the strict hour-to-hour comparison using formatted values.
Please let us know if you have any further thoughts.
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.
OK. That is also unfortunate. What we'd really like is a timestamp round function. elastic/mito#92
}).as(state, state.with( | ||
request( | ||
"GET", | ||
state.url.trim_right("/") + "/api/v3/threat_lists/cryptominer/" + state.start_time + "?" + { |
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.
state.url.trim_right("/") + "/api/v3/threat_lists/cryptominer/" + state.start_time + "?" + { | |
state.url.trim_right("/") + "/api/v3/threat_lists/cryptominer/" + start_time + "?" + { |
packages/ti_google_threat_intelligence/data_stream/cryptominer/agent/stream/cel.yml.hbs
Outdated
Show resolved
Hide resolved
"cursor": { | ||
"last_timestamp": (state.start_time.parse_time("2006010215") + duration("1h")).format("2006010215"), | ||
}, | ||
"want_more": (state.start_time.parse_time("2006010215") + duration("1h")) < (now.format("2006010215")).parse_time("2006010215") |
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.
"want_more": (state.start_time.parse_time("2006010215") + duration("1h")) < (now.format("2006010215")).parse_time("2006010215") | |
"want_more": (start_time.parse_time("2006010215") + duration("1h")) < (now.format("2006010215")).parse_time("2006010215") |
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.
Same comments as above.
… manifest and CEL
/test |
packages/ti_google_threat_intelligence/elasticsearch/transform/rule/transform.yml
Outdated
Show resolved
Hide resolved
must_not: | ||
- match_phrase: | ||
kibana.alert.rule.tags: IOC Stream |
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.
This is indeed confusing as this PR change is dependent on future PRs. We should avoid this if possible in the future.
What is the difference between IOCs ingested from this PR's API i..e., Get Hourly Threat List vs the /ioc_stream
API thats added in #13449?
Is one API better than the other, if so why don't we add only the better one?
@@ -0,0 +1,264 @@ | |||
- name: gti |
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.
Please kindly make a note of all these after items and create a follow up PR. Thanks!
packages/ti_google_threat_intelligence/elasticsearch/transform/domain_ioc/fields/ecs.yml
Show resolved
Hide resolved
packages/ti_google_threat_intelligence/elasticsearch/transform/url_ioc/fields/ecs.yml
Show resolved
Hide resolved
# Bump this version to delete, reinstall, and restart the transform during | ||
# package installation. | ||
fleet_transform_version: 1.0.0 | ||
run_as_kibana_system: 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.
After adding the pipeline, the transform turns Healthy as expected.
This behaviour is very strange. run_as_kibana_system
shouldn't impact the transform health from a pipeline not being present, especially when we don't even have a pipeline by default #13189 (comment).
If its not too much, could you please kindly add a video capturing this behaviour?
packages/ti_google_threat_intelligence/elasticsearch/transform/rule/transform.yml
Show resolved
Hide resolved
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.
My concerns have been addressed, but please wait for @kcreddy.
?"query": has(state.query) ? optional.of([state.query]) : optional.none(), | ||
"limit": ["4000"], | ||
"x-tool": ["Elastic"], | ||
"User-Agent": ["v0.1.0"], // Include integration version here; must match the 'version' in package level manifest.yml |
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; must match the 'version' in package level manifest.yml | |
"User-Agent": ["v0.1.0"], // Keep this in sync with 'version' in package level manifest.yml. |
Same change elsewhere that this comment exists.
# This version must match the User-Agent version used in CEL code. | ||
# Remember to update the User-Agent in CEL code when changing this version. |
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.
✅
state.with({ | ||
"start_time": state.?cursor.last_timestamp.orValue((now - duration(state.initial_interval)).format("2006010215")) | ||
}).as(state, state.with( |
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.
OK. That is also unfortunate. What we'd really like is a timestamp round function. elastic/mito#92
… event.kind in enriched index
/test |
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.
Only waiting on 1 outstanding comment: #13189 (comment)
/test |
💚 Build Succeeded
History
|
|
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.
LGTM. Thank you!
#14287 tracks list of pending issues for making the integration GA.
Package ti_google_threat_intelligence - 0.1.0 containing this change is available at https://epr.elastic.co/package/ti_google_threat_intelligence/0.1.0/ |
- Added 4 data streams (cryptominer, first_stage_delivery_vectors, infostealer, iot). - Added data collection logic for the data streams. - Added the ingest pipeline for the data streams. - Mapped fields according to the ECS schema and added Fields metadata in the appropriate yaml files. - Added dashboards and visualizations. - Added system test cases for the data stream.
What does this PR do?
Checklist
changelog.yml
file.How to test this PR locally