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

Commit 94ec892

Browse files
[client] Add markings support for workbench
1 parent c423b93 commit 94ec892

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pycti/api/opencti_api_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,12 +712,13 @@ def upload_pending_file(self, **kwargs):
712712
data = kwargs.get("data", None)
713713
mime_type = kwargs.get("mime_type", "text/plain")
714714
entity_id = kwargs.get("entity_id", None)
715+
file_markings = kwargs.get("file_markings", [])
715716

716717
if file_name is not None:
717718
self.app_logger.info("Uploading a file.")
718719
query = """
719-
mutation UploadPending($file: Upload!, $entityId: String) {
720-
uploadPending(file: $file, entityId: $entityId) {
720+
mutation UploadPending($file: Upload!, $entityId: String, $file_markings: [String!]) {
721+
uploadPending(file: $file, entityId: $entityId, file_markings: $file_markings) {
721722
id
722723
name
723724
}
@@ -731,7 +732,11 @@ def upload_pending_file(self, **kwargs):
731732
mime_type = magic.from_file(file_name, mime=True)
732733
return self.query(
733734
query,
734-
{"file": (File(file_name, data, mime_type)), "entityId": entity_id},
735+
{
736+
"file": (File(file_name, data, mime_type)),
737+
"entityId": entity_id,
738+
"file_markings": file_markings,
739+
},
735740
)
736741
else:
737742
self.app_logger.error("[upload] Missing parameter: file_name")

pycti/connector/opencti_connector_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,7 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
15811581
event_version = kwargs.get("event_version", None)
15821582
bypass_validation = kwargs.get("bypass_validation", False)
15831583
entity_id = kwargs.get("entity_id", None)
1584+
file_markings = kwargs.get("file_markings", None)
15841585
file_name = kwargs.get("file_name", None)
15851586
bundle_send_to_queue = kwargs.get("send_to_queue", self.bundle_send_to_queue)
15861587
cleanup_inconsistent_bundle = kwargs.get("cleanup_inconsistent_bundle", False)
@@ -1648,6 +1649,7 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
16481649
data=bundle,
16491650
mime_type="application/json",
16501651
entity_id=entity_id,
1652+
file_markings=file_markings,
16511653
)
16521654
return []
16531655
elif validation_mode == "draft" and not draft_id:

0 commit comments

Comments
 (0)