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

Adding Cloud Alerts Layout #31118

Merged
merged 83 commits into from Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
7d619cd
Change the field to be searchable
ssokolovich Nov 26, 2023
b097fb9
RN
ssokolovich Nov 26, 2023
1cda2ff
Added missing scripts
ssokolovich Nov 26, 2023
2e9c7db
Added new layout rule
ssokolovich Nov 26, 2023
183479d
Merge branch 'master' of github.com:demisto/content into ss_cloud_ale…
ssokolovich Nov 26, 2023
35ca1fc
UPDATED SCRIPT
ssokolovich Dec 4, 2023
9b5753a
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 4, 2023
4273565
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 4, 2023
9d74edc
Merge branch 'master' of github.com:demisto/content into ss_cloud_ale…
ssokolovich Dec 5, 2023
26e7130
Fixed more pre-commit errors
ssokolovich Dec 5, 2023
23a6da9
Updated RN
ssokolovich Dec 5, 2023
b23650d
Removed un-required script
ssokolovich Dec 5, 2023
32dad84
Removed un-required script
ssokolovich Dec 5, 2023
0402f5c
Removed un-required script
ssokolovich Dec 5, 2023
bace013
Removed un-required script
ssokolovich Dec 5, 2023
992e774
Added tests
ssokolovich Dec 5, 2023
0a11602
Merge branch 'master' of github.com:demisto/content into ss_cloud_ale…
ssokolovich Dec 6, 2023
a78ad4a
Added a test for main
ssokolovich Dec 6, 2023
c63e93d
Added a test for main
ssokolovich Dec 6, 2023
0206f8e
Added a test for main
ssokolovich Dec 6, 2023
38d519e
Added a test for main
ssokolovich Dec 6, 2023
d9ced74
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 6, 2023
0c479b7
Updated main test
ssokolovich Dec 6, 2023
cab01a0
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 6, 2023
0088db3
Updated main test
ssokolovich Dec 6, 2023
b05c83e
Updated main test
ssokolovich Dec 6, 2023
4395f17
Updated main test
ssokolovich Dec 6, 2023
c1cbcef
removed main tests
ssokolovich Dec 6, 2023
c0ca4a7
removed main tests
ssokolovich Dec 6, 2023
cd65e20
fixed tests
ssokolovich Dec 7, 2023
887c162
added MP
ssokolovich Dec 7, 2023
567d1db
added MP
ssokolovich Dec 7, 2023
066ad11
Updated README.md
ssokolovich Dec 7, 2023
27b0402
Updated README.md
ssokolovich Dec 7, 2023
b578f42
Merge branch 'master' of github.com:demisto/content into ss_cloud_ale…
ssokolovich Dec 7, 2023
65e908a
Merge branch 'master' into ss_cloud_alert_layout
MLainer1 Dec 7, 2023
4badece
removed unrequited import
ssokolovich Dec 7, 2023
5e01472
pre-commit
ssokolovich Dec 7, 2023
0967ca3
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 17, 2023
d2673c8
Updated RN description
ssokolovich Dec 17, 2023
8e3a482
Merged master into current branch.
Dec 20, 2023
2643151
Bump pack from version CloudIncidentResponse to 1.0.10.
Dec 20, 2023
16cc78f
alert source
ssokolovich Dec 20, 2023
5106e94
Merge remote-tracking branch 'origin/ss_cloud_alert_layout' into ss_c…
ssokolovich Dec 20, 2023
fe2904d
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 20, 2023
8359b9a
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 21, 2023
2cf5405
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 21, 2023
2df4be8
Added missing scripts
ssokolovich Nov 26, 2023
bc7f977
Added new layout rule
ssokolovich Nov 26, 2023
07a1b2f
UPDATED SCRIPT
ssokolovich Dec 4, 2023
03f22c6
Fixed more pre-commit errors
ssokolovich Dec 5, 2023
05c5eef
Removed un-required script
ssokolovich Dec 5, 2023
16dca17
Removed un-required script
ssokolovich Dec 5, 2023
01a915f
Removed un-required script
ssokolovich Dec 5, 2023
6c3e9e7
Removed un-required script
ssokolovich Dec 5, 2023
5806719
Added tests
ssokolovich Dec 5, 2023
493db91
Added a test for main
ssokolovich Dec 6, 2023
206ce20
Added a test for main
ssokolovich Dec 6, 2023
713f182
Added a test for main
ssokolovich Dec 6, 2023
2eb1fb1
Added a test for main
ssokolovich Dec 6, 2023
c69909b
Updated main test
ssokolovich Dec 6, 2023
9abffbc
Updated main test
ssokolovich Dec 6, 2023
70fa453
Updated main test
ssokolovich Dec 6, 2023
6940c79
Updated main test
ssokolovich Dec 6, 2023
b70c043
removed main tests
ssokolovich Dec 6, 2023
728a69b
removed main tests
ssokolovich Dec 6, 2023
2cac5db
fixed tests
ssokolovich Dec 7, 2023
750850d
added MP
ssokolovich Dec 7, 2023
7079281
added MP
ssokolovich Dec 7, 2023
28c401f
Updated README.md
ssokolovich Dec 7, 2023
f24b742
Updated README.md
ssokolovich Dec 7, 2023
4bd6b05
removed unrequited import
ssokolovich Dec 7, 2023
526da3e
pre-commit
ssokolovich Dec 7, 2023
cd8a225
Updated RN description
ssokolovich Dec 17, 2023
e218000
alert source
ssokolovich Dec 20, 2023
545aef2
Bump pack from version CloudIncidentResponse to 1.0.10.
Dec 20, 2023
c1cdcaf
[SanePdfReport] - Increase resourceTimeout (#31513)
michal-dagan Dec 21, 2023
94974c1
Merge remote-tracking branch 'origin/ss_cloud_alert_layout' into ss_c…
ssokolovich Dec 21, 2023
087d780
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 21, 2023
d26270b
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 21, 2023
e792005
Reverted to master
ssokolovich Dec 21, 2023
09c46f9
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 24, 2023
8eeb5c3
Merge branch 'master' into ss_cloud_alert_layout
ssokolovich Dec 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,46 @@
{
"rule_id": "Cloud_Alerts_rule",
"layout_id": "Cloud Alerts",
"description": "Default display for Cloud Alerts generated by XDR Analytics.",
"rule_name": "Cloud Alerts Layout Rule",
"alerts_filter": {
"filter": {
altmannyarden marked this conversation as resolved.
Show resolved Hide resolved
"AND": [
{
"OR": [
{
"SEARCH_FIELD": "cloud_provider",
"SEARCH_TYPE": "EQ",
"SEARCH_VALUE": "AWS"
},
{
"SEARCH_FIELD": "cloud_provider",
"SEARCH_TYPE": "EQ",
"SEARCH_VALUE": "AZURE"
},
{
"SEARCH_FIELD": "cloud_provider",
"SEARCH_TYPE": "EQ",
"SEARCH_VALUE": "GCP"
}
]
},
{
"OR": [
{
"SEARCH_FIELD": "alert_source",
"SEARCH_TYPE": "EQ",
"SEARCH_VALUE": "ANALYTICS_BIOC"
},
{
"SEARCH_FIELD": "alert_source",
"SEARCH_TYPE": "EQ",
"SEARCH_VALUE": "MAGNIFIER"
}
]
}
]
}
},
"fromVersion": "6.10.0"
}
1,390 changes: 1,390 additions & 0 deletions Packs/CloudIncidentResponse/Layouts/layoutscontainer-Cloud_Alerts.json

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Packs/CloudIncidentResponse/ReleaseNotes/1_0_10.md
@@ -0,0 +1,18 @@

#### Layout Rules

##### New: Cloud Alerts Layout Rule

- New: Cloud Alerts layout Rule (Available from Cortex XSIAM 2.0).

#### Layouts

##### New: Cloud Alerts

- New: Cloud Alerts layout (Available from Cortex XSIAM 2.0).

#### Scripts

##### New: XCloudAdditionalAlertInformationWidget

- New: This script retrieves additional original alert information from the context. (Available from Cortex XCLOUD).
@@ -0,0 +1,30 @@
This script retrieves additional original alert information from the context.

## Script Data

---

| **Name** | **Description** |
| --- | --- |
| Script Type | python3 |
| Tags | dynamic-section |
| Cortex XSOAR Version | 6.10.0 |

## Dependencies

---
This script uses the following commands and scripts.

* SetByIncidentId
* core-get-cloud-original-alerts
* Cortex Core - IR

## Inputs

---
There are no inputs for this script.

## Outputs

---
There are no outputs for this script.
@@ -0,0 +1,72 @@
from CommonServerPython import * # noqa: F401


''' COMMAND FUNCTION '''


def get_additonal_info() -> List[Dict]:
alerts = demisto.context().get('Core', {}).get('OriginalAlert')
if not alerts:
raise DemistoException('Original Alert is not configured in context')
if not isinstance(alerts, list):
alerts = [alerts]

results = []
for alert in alerts:
alert_event = alert.get('event')
res = {'Alert Full Description': alert.get('alert_full_description'),
'Detection Module': alert.get('detection_modules'),
'Vendor': alert_event.get('vendor'),
'Provider': alert_event.get('cloud_provider'),
'Log Name': alert_event.get('log_name'),
'Event Type': demisto.get(alert_event, 'raw_log.eventType'),
'Caller IP': alert_event.get('caller_ip'),
'Caller IP Geo Location': alert_event.get('caller_ip_geolocation'),
'Resource Type': alert_event.get('resource_type'),
'Identity Name': alert_event.get('identity_name'),
'Operation Name': alert_event.get('operation_name'),
'Operation Status': alert_event.get('operation_status'),
'User Agent': alert_event.get('user_agent')}
results.append(res)
indicators = [res.get('Caller IP') for res in results]
indicators_callable = indicators_value_to_clickable(indicators)
for res in results:
res['Caller IP'] = indicators_callable.get(res.get('Caller IP'))
return results


def verify_list_type(original_alert_data):
if isinstance(original_alert_data, list):
res = original_alert_data[0].get('EntryContext')
res['OriginalAlert'] = res.pop('Core.OriginalAlert(val.internal_id && val.internal_id == obj.internal_id)')
if isinstance(res['OriginalAlert'], list):
res['OriginalAlert'] = res['OriginalAlert'][0]
return res
return None


''' MAIN FUNCTION '''


def main(): # pragma: no cover
try:
alert_context = demisto.investigation()
core_alert_context = demisto.context().get('Core', {})
if not core_alert_context.get('OriginalAlert'):
original_alert_data = demisto.executeCommand('core-get-cloud-original-alerts', {"alert_ids": alert_context.get('id')})
if original_alert_data:
res = verify_list_type(original_alert_data)
demisto.executeCommand('SetByIncidentId', {"key": "Core", "value": res, "id": alert_context.get('id')})
results = get_additonal_info()
command_results = CommandResults(
readable_output=tableToMarkdown('Original Alert Additional Information', results,
headers=list(results[0].keys()) if results else None))
return_results(command_results)
except Exception as ex:
return_error(f'Failed to execute AdditionalAlertInformationWidget. Error: {str(ex)}')


''' ENTRY POINT '''

if __name__ in ('__main__', '__builtin__', 'builtins'):
main()
@@ -0,0 +1,21 @@
commonfields:
id: XCloudAdditionalAlertInformationWidget
version: -1
name: XCloudAdditionalAlertInformationWidget
script: ''
type: python
tags:
- dynamic-section
comment: This script retrieves additional original alert information from the context.
enabled: true
scripttarget: 0
subtype: python3
runonce: false
dockerimage: demisto/python3:3.10.13.83255
runas: DBotWeakRole
engineinfo: {}
fromversion: 6.10.0
marketplaces:
- marketplacev2
tests:
- No tests (auto formatted)
@@ -0,0 +1,62 @@
import unittest
from unittest.mock import patch
from XCloudAdditionalAlertInformationWidget import *


class TestXCloudAdditionalAlertInformationWidget(unittest.TestCase):

@patch('demistomock.context', return_value={'Core': {'OriginalAlert': [{'event': {'alert_full_description': None,
'detection_modules': None,
'vendor': 'Vendor1',
'cloud_provider': 'AWS',
'log_name': 'SecurityLog',
'raw_log': {'eventType': 'Event1'},
'caller_ip': '192.168.1.1',
'caller_ip_geolocation': 'Location1',
'resource_type': 'ResourceType1',
'identity_name': 'User1',
'operation_name': 'Operation1',
'operation_status': 'Success',
'user_agent': 'Browser1'}}]}})
def test_get_additonal_info(self, mock_context):
# Test with a mock context containing one original alert
expected_result = [{'Alert Full Description': None,
'Detection Module': None,
'Vendor': 'Vendor1',
'Provider': 'AWS',
'Log Name': 'SecurityLog',
'Event Type': 'Event1',
'Caller IP': None,
'Caller IP Geo Location': 'Location1',
'Resource Type': 'ResourceType1',
'Identity Name': 'User1',
'Operation Name': 'Operation1',
'Operation Status': 'Success',
'User Agent': 'Browser1'}]

result = get_additonal_info() # Corrected function name
assert result == expected_result

def test_verify_list_type_dict(self):
input_dict = [{
"EntryContext": {"Core.OriginalAlert(val.internal_id && val.internal_id == obj.internal_id)": {"id": "123"}}}]
expected_output = {"OriginalAlert": {"id": "123"}}
output = verify_list_type(input_dict)
assert output == expected_output

def test_verify_list_type_list(self):
input_list = [
{"EntryContext": {"Core.OriginalAlert(val.internal_id && val.internal_id == obj.internal_id)": {"id": "123"}}}]
expected_output = {"OriginalAlert": {"id": "123"}}
output = verify_list_type(input_list)
assert output == expected_output

def test_verify_list_type_empty(self):
input = None
expected_output = None
output = verify_list_type(input)
assert output == expected_output


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion Packs/CloudIncidentResponse/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "Cloud Incident Response",
"description": "This content Pack helps you automate collection, investigation, and remediation of incidents related to cloud infrastructure activities in AWS, Azure, and GCP.",
"support": "xsoar",
"currentVersion": "1.0.9",
"currentVersion": "1.0.10",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down