[CrowdStrike] Add motivations and adversary type as labels on IntrusionSet#6129
[CrowdStrike] Add motivations and adversary type as labels on IntrusionSet#6129
Conversation
…ionSet Agent-Logs-Url: https://github.com/OpenCTI-Platform/connectors/sessions/1e918c5b-625a-4cfc-9d58-d21348f5fcad Co-authored-by: CTIBurn0ut <187056606+CTIBurn0ut@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds additional analyst-friendly context to CrowdStrike actor ingestion by surfacing raw CrowdStrike motivation values and actor_type as labels on generated STIX IntrusionSet objects, with accompanying test coverage. Most other touched files are import-order changes from formatting.
Changes:
- Add
labelsgeneration (raw motivation values +actor_type) forIntrusionSetcreation in both actor builders. - Add a dedicated test module covering label behavior for both builders.
- Apply import ordering/formatting updates across CrowdStrike connector modules.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| external-import/crowdstrike/tests/actor_labels_import/test_actor_labels_import.py | New tests validating motivations/actor_type surfaced as IntrusionSet.labels. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/actor/builder.py | Adds _get_labels() and passes labels into create_intrusion_set(). |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/related_actors/builder.py | Adds label extraction and passes labels into create_intrusion_set(). |
| external-import/crowdstrike/src/main.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/utils/report_fetcher.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/base_api.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/actors.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/indicators.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/malware.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/reports.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/rules.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_services/client/vulnerabilities.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/connector.py | Import spacing/ordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/settings.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/actor/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/related_actors/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/indicator/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/indicator/builder.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/malware/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/malware/builder.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/report/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/report/builder.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/vulnerability/importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/vulnerability/builder.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/rule/yara_master_importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/rule/yara_master_builder.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/rule/snort_suricata_master_importer.py | Import reordering only. |
| external-import/crowdstrike/src/crowdstrike_feeds_connector/rule/snort_suricata_master_builder.py | Import reordering only. |
external-import/crowdstrike/tests/actor_labels_import/test_actor_labels_import.py
Outdated
Show resolved
Hide resolved
external-import/crowdstrike/src/crowdstrike_feeds_connector/related_actors/builder.py
Outdated
Show resolved
Hide resolved
| # Labels: raw CrowdStrike motivation values and actor_type | ||
| labels: list[str] = [] | ||
| for mot in motivations_raw: | ||
| if isinstance(mot, Mapping): | ||
| val = str(mot.get("value") or mot.get("slug") or "").strip() | ||
| else: | ||
| val = str(mot).strip() | ||
| if val: | ||
| labels.append(val) | ||
| actor_type = actor.get("actor_type") | ||
| if actor_type: | ||
| actor_type_str = str(actor_type).strip() | ||
| if actor_type_str: | ||
| labels.append(actor_type_str) | ||
|
|
There was a problem hiding this comment.
The label-extraction logic here duplicates the new _get_labels() logic in actor/builder.py (motivation value/slug normalization + actor_type). Consider centralizing this into a shared helper (e.g., in crowdstrike_feeds_services.utils) to avoid diverging behavior between the two builders over time.
There was a problem hiding this comment.
Need Product/Integration input on how the team wants to handle this.
@Kakudou
@Ninoxe
@helene-nguyen
…or_labels_import.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot — Please revert all import reordering/formatting changes across the 26 non-feature files. The only files that should have changes in this PR are:
All other files should be reverted to their original state (no import reordering). The existing import ordering convention in the repo should be preserved — do not apply |
… guard for motivations_raw Agent-Logs-Url: https://github.com/OpenCTI-Platform/connectors/sessions/556c2342-7b46-498d-b0d8-4b0efb45a29a Co-authored-by: CTIBurn0ut <187056606+CTIBurn0ut@users.noreply.github.com>
Done in cbcfce4. Reverted all 26 formatting-only files to their pre-feature state. The PR now only contains changes to the 3 intended files: Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot The CI
Do NOT touch any other files. Only fix the import ordering in these 3 files to pass the |
Agent-Logs-Url: https://github.com/OpenCTI-Platform/connectors/sessions/c2359958-4641-41f2-9714-dba523423498 Co-authored-by: CTIBurn0ut <187056606+CTIBurn0ut@users.noreply.github.com>
Fixed in 55a4823. Ran |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6129 +/- ##
===========================================
- Coverage 39.46% 4.33% -35.13%
===========================================
Files 2082 1650 -432
Lines 124176 100064 -24112
===========================================
- Hits 49007 4340 -44667
- Misses 75169 95724 +20555
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CTIBurn0ut
left a comment
There was a problem hiding this comment.
All looks good - however the code outlined is duplicate and could be moved to utils but need design decision made.
| # Labels: raw CrowdStrike motivation values and actor_type | ||
| labels: list[str] = [] | ||
| for mot in motivations_raw: | ||
| if isinstance(mot, Mapping): | ||
| val = str(mot.get("value") or mot.get("slug") or "").strip() | ||
| else: | ||
| val = str(mot).strip() | ||
| if val: | ||
| labels.append(val) | ||
| actor_type = actor.get("actor_type") | ||
| if actor_type: | ||
| actor_type_str = str(actor_type).strip() | ||
| if actor_type_str: | ||
| labels.append(actor_type_str) | ||
|
|
There was a problem hiding this comment.
Need Product/Integration input on how the team wants to handle this.
@Kakudou
@Ninoxe
@helene-nguyen
actor/builder.py: added_get_labels()method extracting raw motivation values andactor_type; passeslabelstocreate_intrusion_set()related_actors/builder.py: extract raw motivation values andactor_typeas labels; guard motivations loop withisinstance(motivations_raw, list); passeslabelstocreate_intrusion_set()tests/actor_labels_import/test_actor_labels_import.pywith 11 tests covering both buildersisort --profile black --line-length 88to the 3 feature files to fix CI check