Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions pycti/api/opencti_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,13 @@ def upload_pending_file(self, **kwargs):
data = kwargs.get("data", None)
mime_type = kwargs.get("mime_type", "text/plain")
entity_id = kwargs.get("entity_id", None)
file_markings = kwargs.get("file_markings", [])

if file_name is not None:
self.app_logger.info("Uploading a file.")
query = """
mutation UploadPending($file: Upload!, $entityId: String) {
uploadPending(file: $file, entityId: $entityId) {
mutation UploadPending($file: Upload!, $entityId: String, $file_markings: [String!]) {
uploadPending(file: $file, entityId: $entityId, file_markings: $file_markings) {
id
name
}
Expand All @@ -731,7 +732,11 @@ def upload_pending_file(self, **kwargs):
mime_type = magic.from_file(file_name, mime=True)
return self.query(
query,
{"file": (File(file_name, data, mime_type)), "entityId": entity_id},
{
"file": (File(file_name, data, mime_type)),
"entityId": entity_id,
"file_markings": file_markings,
},
)
else:
self.app_logger.error("[upload] Missing parameter: file_name")
Expand Down
2 changes: 2 additions & 0 deletions pycti/connector/opencti_connector_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,7 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
event_version = kwargs.get("event_version", None)
bypass_validation = kwargs.get("bypass_validation", False)
entity_id = kwargs.get("entity_id", None)
file_markings = kwargs.get("file_markings", None)
file_name = kwargs.get("file_name", None)
bundle_send_to_queue = kwargs.get("send_to_queue", self.bundle_send_to_queue)
cleanup_inconsistent_bundle = kwargs.get("cleanup_inconsistent_bundle", False)
Expand Down Expand Up @@ -1648,6 +1649,7 @@ def send_stix2_bundle(self, bundle: str, **kwargs) -> list:
data=bundle,
mime_type="application/json",
entity_id=entity_id,
file_markings=file_markings,
)
return []
elif validation_mode == "draft" and not draft_id:
Expand Down