Skip to content

Commit

Permalink
Fix/XSUP-34055/Unable to fetch incidents using XSOAR Mirroring integr…
Browse files Browse the repository at this point in the history
…ation (#33155)

* fix default key

* rn

* docker

* docs review

* [ConvertFile] Bump Docker version (#33141)

* Update Docker version

* Bump version

* ruff

* Bump pack from version CommonScripts to 1.14.4.

* Bump Docker version

* Bump pack from version CommonScripts to 1.14.5.

* Bump pack from version CommonScripts to 1.14.6.

---------

Co-authored-by: Content Bot <bot@demisto.com>

* Added Compatibility with new Allowed Indicator Module in CTIX 3.6 (#33062) (#33159)

I also ran all of the pre-commit hooks and resolved all of those issues.

Co-authored-by: Corey Bodendein <corey.bodendein@cyware.com>

* Fix/[XSUP-33795]/Logo does not shown in data collection form (#33154)

* change default to true

* add s flag

* add UT

* RN

* pre-commit

* mocker

* fix default key

* revert

* EWS v2: added arg to the command (#33096)

* added arg to the command

* Apply suggestions from code review

Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>

* fix validate

---------

Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>

* Rasterize Latest Poppler (#32997)

* Teams generate url command bug (#33164)

* fixed a bug in generate url command

* added rn

* added rn

* edit

* added bc rn

* edits

* fixed unit test

* updated do

* Enhancement | InfoBlox - add list host and network info, modify get IP cmds (#32619)

* added host records

* handle no comma,equal sign in extattrs

* wip: added network,to/from_ip args to get_ip_cmd

* added validation for invalid input args to get-ip

moved request params into client

* added max_results to list host cmd

* added network info cmd

* modified get-ip command to return a list

added rns

* format/validation fixes

* fixed context output for host records cmd

* fixed output table for net info cmd

* added additional return fields to list host args

parsed extattrs into dict for context

* updated integration docs

added command examples

fixed context key in net info command

added types to context outputs for list host and net cmds

* fixed netview context key in net uts

* changed context output types for get-ip

added bc mentions for get-ip context output keys

* fixed hardcoded default values in args description

add breaking changes in md

* mv test_files test_data

* mv test_files test_data

* converted integration readme from html to markdown

pr review: empty dict evaluates to false, no need to cast to bool

* strip whitespace from get-ip context path in readme

* add unique to ipv4address status

client params instantiated with _return_as_object=1

add capture stderr ignore

pr review: use any() instead of sum() == 0

* pr review: rm endpoint suffixes from client

pr review: rm max_results from list host commandres title

pr review: add default val for max results to bc

* pr review: rm ip,netmask input validation

rm max_results and added mode/val in title for get-ip-cmd

* mv request params into client methods

* rm transform_return_fields

* simplified raw to context mapping

* raise exception when extattrs input is invalid

* updated docker image

rm max results from hr for net info cmd

added todos for checking unexpected invalid extattrs

rm exception var

* fixed issue with additional return fields

* fix flake8 errs

* rm todos

fixed issue with too many args supplied to ip command

* revert changes to too many args handle in ip cmd

* fixed titles for get-ip, get host info, get network info

* added rn comment about get-ip mod outputs

* fix rn comment about get-ip mod outputs

* fix cmd outputs assertions in uts

* added args to get-ip in integration doc

* update docker image

* fix docs

* revert poetry

* fix docs

* Update README.md (#33211)

edited description of cron argument, per Dudu B.

* download and move images to content repo (#33204)

* download and move images to content repo

* commit test

* revert changes for gitlab_slack_notifier

* Update Docker Image To demisto/chromium  (#33175)

* Updated Metadata Of Pack rasterize

* Added release notes to pack rasterize

* Packs/rasterize/Integrations/rasterize/rasterize.yml Docker image update

* Updated Metadata Of Pack ExpanseV2

* Added release notes to pack ExpanseV2

* Packs/ExpanseV2/Scripts/ExpanseGenerateIssueMapWidgetScript/ExpanseGenerateIssueMapWidgetScript.yml Docker image update

* Bump pack from version ExpanseV2 to 1.10.51.

* Bump pack from version rasterize to 2.0.2.

---------

Co-authored-by: Content Bot <bot@demisto.com>

* docker

* do not write files when running test-module

* RN

* ignore error 125

* docker

* Fix RN

* revert

* ignore investigation attachments in test module command

---------

Co-authored-by: Michael Yochpaz <8832013+MichaelYochpaz@users.noreply.github.com>
Co-authored-by: Content Bot <bot@demisto.com>
Co-authored-by: content-bot <55035720+content-bot@users.noreply.github.com>
Co-authored-by: Corey Bodendein <corey.bodendein@cyware.com>
Co-authored-by: Israel Lappe <79846863+ilappe@users.noreply.github.com>
Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>
Co-authored-by: tkatzir <tkatzir@paloaltonetworks.com>
Co-authored-by: merit-maita <49760643+merit-maita@users.noreply.github.com>
Co-authored-by: Kobbi Gal <85439776+kgal-pan@users.noreply.github.com>
Co-authored-by: Tamar Schanfeld <76044549+tschanfeld@users.noreply.github.com>
Co-authored-by: israelpoli <72099621+israelpoli@users.noreply.github.com>
  • Loading branch information
12 people committed Mar 21, 2024
1 parent 7e1f456 commit 6c36817
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 24 deletions.
46 changes: 24 additions & 22 deletions Packs/XSOARmirroring/Integrations/XSOARmirroring/XSOARmirroring.py
Expand Up @@ -351,7 +351,7 @@ def fetch_incidents(client: Client, max_results: int, last_run: dict[str, Union[

for incident in incidents:
incident_result: dict[str, Any] = {}
incident_result['dbotMirrorDirection'] = MIRROR_DIRECTION[mirror_direction] # type: ignore
incident_result['dbotMirrorDirection'] = MIRROR_DIRECTION.get(mirror_direction) # type: ignore
incident['dbotMirrorInstance'] = demisto.integrationInstance()
incident_result['dbotMirrorTags'] = mirror_tag if mirror_tag else None # type: ignore
incident_result['dbotMirrorId'] = incident['id']
Expand All @@ -369,28 +369,30 @@ def fetch_incidents(client: Client, max_results: int, last_run: dict[str, Union[
incident_result['rawJSON'] = json.dumps(incident)

file_attachments = []
if incident.get('attachment') and len(incident.get('attachment', [])) > 0 and incident.get('investigationId'):
entries = client.get_incident_entries(
incident_id=incident['investigationId'], # type: ignore
from_date=0,
max_results=10,
categories=['attachments'],
tags=None,
tags_and_operator=False
)
# When demisto.command() == 'test-module' we can't write files since we are not running in a playground.
if demisto.command() != 'test-module':
if incident.get('attachment') and len(incident.get('attachment', [])) > 0 and incident.get('investigationId'):
entries = client.get_incident_entries(
incident_id=incident['investigationId'], # type: ignore
from_date=0,
max_results=10,
categories=['attachments'],
tags=None,
tags_and_operator=False
)

for entry in entries:
if 'file' in entry and entry.get('file'):
file_entry_content = client.get_file_entry(entry.get('id')) # type: ignore
file_result = fileResult(entry['file'], file_entry_content)
if any(attachment.get('name') == entry['file'] for attachment in incident.get('attachment', [])):
if file_result['Type'] == EntryType.ERROR:
raise Exception(f"Error getting attachment: {str(file_result.get('Contents', ''))}")

file_attachments.append({
'path': file_result.get('FileID', ''),
'name': file_result.get('File', '')
})
for entry in entries:
if 'file' in entry and entry.get('file'):
file_entry_content = client.get_file_entry(entry.get('id')) # type: ignore
file_result = fileResult(entry['file'], file_entry_content)
if any(attachment.get('name') == entry['file'] for attachment in incident.get('attachment', [])):
if file_result['Type'] == EntryType.ERROR:
raise Exception(f"Error getting attachment: {str(file_result.get('Contents', ''))}")

file_attachments.append({
'path': file_result.get('FileID', ''),
'name': file_result.get('File', '')
})

incident_result['attachment'] = file_attachments
incidents_result.append(incident_result)
Expand Down
Expand Up @@ -156,7 +156,7 @@ script:
- name: get-mapping-fields
arguments: []
description: Retrieves the mapping schema from a remote incident.
dockerimage: demisto/python3:3.10.13.80593
dockerimage: demisto/python3:3.10.13.89009
isfetch: true
subtype: python3
ismappable: true
Expand Down
7 changes: 7 additions & 0 deletions Packs/XSOARmirroring/ReleaseNotes/2_0_23.md
@@ -0,0 +1,7 @@

#### Integrations

##### XSOAR Mirroring

- Updated the Docker image to: *demisto/python3:3.10.13.89009*.
- Fixed an issue where the integration test failed when fetch-incidents was enabled.
2 changes: 1 addition & 1 deletion Packs/XSOARmirroring/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "XSOAR Mirroring",
"description": "Allows mirroring of XSOAR incidents between different instances.",
"support": "xsoar",
"currentVersion": "2.0.22",
"currentVersion": "2.0.23",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit 6c36817

Please sign in to comment.