Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 2e2a744

Browse files
committed
Merge branch 'release/6.5.0'
2 parents 8b8e03c + 131c61e commit 2e2a744

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = "OpenCTI client for Python"
22-
copyright = "2024, Filigran"
22+
copyright = "2025, Filigran"
2323
author = "OpenCTI Project"
2424

2525
# The full version, including alpha/beta/rc tags

pycti/api/opencti_api_work.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ def add_expectations(self, work_id: str, expectations: int):
8282
except:
8383
self.api.app_logger.error("Cannot report expectation")
8484

85+
def add_draft_context(self, work_id: str, draft_context: str):
86+
if self.api.bundle_send_to_queue:
87+
self.api.app_logger.info(
88+
"Update draft context",
89+
{"work_id": work_id, "draft_context": draft_context},
90+
)
91+
query = """
92+
mutation addDraftContext($id: ID!, $draftContext: String) {
93+
workEdit(id: $id) {
94+
addDraftContext(draftContext: $draftContext)
95+
}
96+
}
97+
"""
98+
try:
99+
self.api.query(query, {"id": work_id, "draftContext": draft_context})
100+
except:
101+
self.api.app_logger.error("Cannot report draft context")
102+
85103
def initiate_work(self, connector_id: str, friendly_name: str) -> str:
86104
if self.api.bundle_send_to_queue:
87105
self.api.app_logger.info("Initiate work", {"connector_id": connector_id})

pycti/connector/opencti_connector_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,6 +1732,8 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
17321732
if bundle_send_to_queue:
17331733
if work_id:
17341734
self.api.work.add_expectations(work_id, expectations_number)
1735+
if draft_id:
1736+
self.api.work.add_draft_context(work_id, draft_id)
17351737
if entities_types is None:
17361738
entities_types = []
17371739
if self.queue_protocol == "amqp":

pycti/entities/stix_cyber_observable/opencti_stix_cyber_observable_deprecated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class StixCyberObservableDeprecatedMixin:
55
"""
6-
deprecated [>=6.2 & <6.5]`
6+
deprecated [>=6.2 & <6.8]`
77
Promote a Stix-Observable to an Indicator
88
99
:param id: the Stix-Observable id

pycti/utils/opencti_stix2.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,6 +2407,19 @@ def export_selected(
24072407

24082408
return bundle
24092409

2410+
def apply_patch(self, item):
2411+
input = item["opencti_field_patch"]
2412+
if item["type"] == "relationship":
2413+
self.opencti.stix_core_relationship.update_field(id=item["id"], input=input)
2414+
elif item["type"] == "sighting":
2415+
self.opencti.stix_sighting_relationship.update_field(
2416+
id=item["id"], input=input
2417+
)
2418+
elif StixCyberObservableTypes.has_value(item["type"]):
2419+
self.opencti.stix_cyber_observable.update_field(id=item["id"], input=input)
2420+
else:
2421+
self.opencti.stix_domain_object.update_field(id=item["id"], input=input)
2422+
24102423
def import_item(
24112424
self,
24122425
item,
@@ -2426,6 +2439,8 @@ def import_item(
24262439
target_id = item["merge_target_id"]
24272440
source_ids = item["merge_source_ids"]
24282441
self.opencti.stix.merge(id=target_id, object_ids=source_ids)
2442+
elif item["opencti_operation"] == "patch":
2443+
self.apply_patch(item=item)
24292444
else:
24302445
raise ValueError("Not supported opencti_operation")
24312446
elif item["type"] == "relationship":

tests/02-integration/entities/test_observables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def test_promote_observable_to_indicator_deprecated(api_client):
5-
# deprecated [>=6.2 & <6.5]
5+
# deprecated [>=6.2 & <6.8]
66
obs1 = api_client.stix_cyber_observable.create(
77
simple_observable_key="IPv4-Addr.value", simple_observable_value="55.55.55.55"
88
)

0 commit comments

Comments
 (0)