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

Limit alerts number in XDR mirror-in #38066

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 7 additions & 8 deletions Packs/CortexXDR/Integrations/CortexXDRIR/CortexXDRIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,16 +621,15 @@

else: # the incident was not modified
return "The incident was not modified in XDR since the last mirror in.", {}, {}
raw_incident = client.get_multiple_incidents_extra_data(incident_id_list=[incident_id], exclude_artifacts=exclude_artifacts)
# The get_multiple_incident method is limited with the alert numbers, and it's redundant in the get-remote-data command
# as we send only one incident ID at a time.
if demisto.command() != 'get-remote-data':
raw_incident = client.get_multiple_incidents_extra_data(incident_id_list=[incident_id], exclude_artifacts=exclude_artifacts)

Check failure on line 627 in Packs/CortexXDR/Integrations/CortexXDRIR/CortexXDRIR.py

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Ruff (E501)

Packs/CortexXDR/Integrations/CortexXDRIR/CortexXDRIR.py:627:131: E501 Line too long (132 > 130)
else:
demisto.debug(f'for incident: {incident_id} using the old call since the {demisto.command()=}')
raw_incident = client.get_incident_extra_data(incident_id, alerts_limit)
if not raw_incident:
raise DemistoException(f'Incident {incident_id} is not found')
if isinstance(raw_incident, list):
raw_incident = raw_incident[0]
if raw_incident.get('incident', {}).get('alert_count') > ALERTS_LIMIT_PER_INCIDENTS:
demisto.debug(f'for incident:{incident_id} using the old call since "\
"alert_count:{raw_incident.get("incident", {}).get("alert_count")} >" \
"limit:{ALERTS_LIMIT_PER_INCIDENTS}')
raw_incident = client.get_incident_extra_data(incident_id, alerts_limit)
readable_output = [tableToMarkdown(f'Incident {incident_id}', raw_incident.get('incident'), removeNull=True)]

incident = sort_incident_data(raw_incident)
Expand Down
Loading