Skip to content
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

[CrowdStrike] Fix KeyError in CrowdStrike processing #2689

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

initstring
Copy link
Contributor

Proposed changes

The CrowdStike Connector was failing when encountering a specific report from CrowdStrike that had an undefined tag. This PR uses the more resilient get method to obtain a key that may be missing.

Here is a log showing the error:

"level": "ERROR", "name": "Crowdstrike", "message": "CrowdStrike connector internal error: 'value'", "exc_info": "Traceback (most recent call last):\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/core.py\", line 284, in process_message\n importer_state = importer.start(work_id, new_state)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/importer.py\", line 40, in start\n return self.run(state)\n ^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_importer.py\", line 121, in run\n failed = self._process_yara_rule_group(yara_rule_group)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_importer.py\", line 262, in _process_yara_rule_group\n yara_rule_bundle = self._create_yara_rule_bundle(yara_rule, fetched_reports)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_importer.py\", line 396, in _create_yara_rule_bundle\n return bundle_builder.build()\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_builder.py\", line 109, in build\n reports = self._create_reports(object_refs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_builder.py\", line 185, in _create_reports\n report = self._create_report(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_connector/rule/yara_master_builder.py\", line 200, in _create_report\n return create_stix2_report_from_report(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/opt/opencti-connector-crowdstrike/crowdstrike_feeds_services/utils/__init__.py\", line 871, in create_stix2_report_from_report\n value = tag[\"value\"]\n ~~~^^^^^^^^^\nKeyError: 'value'"}

Related issues

N/A

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

@initstring initstring changed the title Fix KeyError in CrowdStrike processing [CrowdStrike] Fix KeyError in CrowdStrike processing Sep 22, 2024
@helene-nguyen helene-nguyen merged commit 47abe92 into OpenCTI-Platform:master Sep 23, 2024
3 checks passed
@helene-nguyen helene-nguyen linked an issue Sep 23, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CrowdStrike] Fix KeyError in CrowdStrike processing
2 participants