PrismaCloud v2
Prisma Cloud secures infrastructure, workloads and applications, across the entire cloud-native technology stack.
Network Security · Prisma Cloud by Palo Alto Networks
Details
| ID | PrismaCloud v2 |
|---|---|
| Provider | Palo Alto Networks |
| Category | Network Security |
| From Version | 6.5.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM EDR Cortex Cloud Cloud Runtime Security |
README
Prisma Cloud secures infrastructure, workloads and applications, across the entire cloud-native technology stack.
This integration was integrated and tested with version 23.2.1 of PrismaCloud
Some changes have been made that might affect your existing content.
If you are upgrading from a previous version of this integration, see Breaking Changes.
Configure Prisma Cloud v2 in Cortex
| Parameter | Description | Required |
|---|---|---|
| Server URL | Prisma Cloud service tenant admin console URL. The URL for the Prisma Cloud service varies depending on the cluster on which your tenant is deployed. For more information see: https://pan.dev/prisma-cloud/api/cspm/api-urls/. | True |
| Username / Access Key ID | True | |
| Password / Access Key Secret | True | |
| Use system proxy settings | False | |
| Trust any certificate (not secure) | False | |
| Incident type | False | |
| Maximum number of incidents to fetch | Maximum is limited to 200. | False |
| First fetch time interval | Date or relative timestamp to start fetching incidents from, in the format of <number> <time unit>. For example, 2 minutes, 12 hours, 6 days, 2 weeks, 3 months, 1 year, ISO timestamp. Default is 3 days. | False |
| Advanced: Time in minutes to look back when fetching incidents | Use this parameter to determine how far back to look in the search for incidents that were created before the last run time and did not match the query when they were created. When choosing to increase this value, duplicate incidents might occur at increase time. | False |
| Fetch only incidents matching these filters | Comma-separated list of filter name and value, in the following format: filtername1=filtervalue1,filtername2=filtervalue2,etc. Names and possible values for filters can be found by running the “prisma-cloud-alert-filter-list” command. | False |
| Fetch incidents | ||
| Incident Mirroring Direction | Choose the direction to mirror the incident: Incoming (from Prisma Cloud to Cortex XSOAR), Outgoing (from Cortex XSOAR to Prisma Cloud), or Incoming and Outgoing (from/to Cortex XSOAR and Prisma Cloud). Cortex XSOAR only parameter. | False |
| Close Mirrored XSOAR Incident | When selected, closing and re-opening the Prisma Cloud alert is mirrored in Cortex XSOAR. Cortex XSOAR only parameter. | False |
| Close Mirrored Prisma Cloud Alert | When selected, closing and re-opening the Cortex XSOAR incident is mirrored in Prisma Cloud. | False |
| Output results of V1 commands to the context data in the old format | False |
Incident Mirroring
You can enable incident mirroring between Cortex XSOAR incidents and Prisma Cloud alerts (available from Cortex XSOAR version 6.0.0).
To setup the mirroring follow these instructions:
- Navigate to Settings > Integrations > Servers & Services.
- Search for Prisma Cloud v2 and select your integration instance.
- Enable Fetches incidents.
- Optional: You can go to the Fetch only incidents matching these filters parameter and select the query to fetch the alerts from Prisma Cloud.
- In the Incident Mirroring Direction parameter, select in which direction the incidents should be mirrored:
- Incoming - Changes in Prisma Cloud Alerts (
status,dismissalNote,reason) will be reflected in Cortex XSOAR incidents. - Outgoing - Changes in Cortex XSOAR incidents will be reflected in Prisma Cloud alerts (
status,reason). - Incoming And Outgoing - Changes in Cortex XSOAR incidents and in Prisma Cloud alerts will be reflected in both directions.
- None - Turns off incident mirroring.
- Incoming - Changes in Prisma Cloud Alerts (
- Optional: Check the Close Mirrored XSOAR Incident integration parameter to close or reopen the Cortex XSOAR incident when the corresponding alert is closed or re-opened in Prisma Cloud.
- Optional: Check the Close Mirrored Prisma Cloud Alert integration parameter to close or reopen the Prisma Cloud alert when the corresponding Cortex XSOAR incident is closed or re-opened.
Newly fetched incidents will be mirrored in the chosen direction. However, this selection does not affect existing incidents.
Important Notes
- To ensure the mirroring works as expected, an incoming mapper is required, to map the expected fields in Cortex XSOAR (you can use the default mapper - Prisma Cloud - Incoming Mapper).
- When mirroring in incidents from Prisma Cloud to Cortex XSOAR:
- When enabling the Close Mirrored XSOAR Incident integration parameter, the field in Prisma Cloud that determines whether the incident was closed or re-opend is the
statusfield.
- When enabling the Close Mirrored XSOAR Incident integration parameter, the field in Prisma Cloud that determines whether the incident was closed or re-opend is the
- When mirroring out incidents from Cortex XSOAR to Prisma Cloud:
- When enabling the Close Mirrored Prisma Cloud Alert integration parameter, the corresponding alert in Prisma Cloud will be closed with a Dismissed status for every reason chosen in the Cortex XSOAR incident (possible reasons are:
False Positive,Duplicate,OtherandResolved). The Reason field of the Prisma Cloud alert will include the original reason selected in Cortex XSOAR and the close notes. - When re-opening a Cortex XSOAR incident with a
ResolvedPrisma Cloud status, the incident will be re-opened, but the alert in Prisma Cloud will remain Resolved due to API limitations.
- When enabling the Close Mirrored Prisma Cloud Alert integration parameter, the corresponding alert in Prisma Cloud will be closed with a Dismissed status for every reason chosen in the Cortex XSOAR incident (possible reasons are:
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
prisma-cloud-alert-dismiss
Dismiss or snooze the alerts matching the given filter. Either policy IDs or alert IDs must be provided. When no absolute time nor relative time arguments are provided, the default time range is all times. For snoozing, provide “snooze_unit” and “snooze_value” arguments.
Base Command
prisma-cloud-alert-dismiss
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_ids | Comma-separated list of alert IDs to be dismissed. | Optional |
| policy_ids | Comma-separated list of policy IDs. | Optional |
| snooze_value | The amount of time for snoozing alert. Both snooze value and unit must be specified if snoozing. | Optional |
| snooze_unit | The time unit for snoozing alert. Both snooze value and unit must be specified if snoozing. Possible values are: hour, day, week, month, year. | Optional |
| dismissal_note | Reason for dismissal. | Required |
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| filters | Comma-separated list of filter name and value, in the following format: filtername1=filtervalue1,filtername2=filtervalue2,etc. Names and possible values for filters can be found by running the “prisma-cloud-alert-filter-list” command. | Optional |
Context Output
There is no context output for this command.
Command example
!prisma-cloud-alert-dismiss dismissal_note="from XSOAR" alert_ids=P-464811 snooze_unit=hour snooze_value=1
Human Readable Output
Alerts snoozed successfully
Snooze note: from XSOAR.
Command example
!prisma-cloud-alert-dismiss dismissal_note="from XSOAR" alert_ids=P-469663 time_range_unit=month
Human Readable Output
Alerts dismissed successfully
Dismissal note: from XSOAR.
prisma-cloud-alert-get-details
Gets the details of an alert based on the alert ID.
Base Command
prisma-cloud-alert-get-details
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_id | The alert ID. | Required |
| detailed | Whether to retrieve the entire / trimmed alert model. Possible values are: true, false. Default is true. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Alert.id | String | The alert ID. |
| PrismaCloud.Alert.status | String | The alert status. |
| PrismaCloud.Alert.reason | String | The alert reason. |
| PrismaCloud.Alert.alertTime | Date | The time of the alert. |
| PrismaCloud.Alert.firstSeen | Date | The time the alert was first seen. |
| PrismaCloud.Alert.lastSeen | Date | The time the alert was last seen. |
| PrismaCloud.Alert.eventOccurred | Date | The time the event occurred. |
| PrismaCloud.Alert.alertRules | String | Names of the alert rules that triggered this alert. |
| PrismaCloud.Alert.resource.resourceApiName | String | The resource API name. |
| PrismaCloud.Alert.resource.id | String | The resource ID. |
| PrismaCloud.Alert.resource.account | String | The resource account. |
| PrismaCloud.Alert.resource.accountId | String | The resource account ID. |
| PrismaCloud.Alert.resource.resourceType | String | The resource type. |
| PrismaCloud.Alert.policy.policyId | String | The policy ID. |
| PrismaCloud.Alert.policy.name | String | The policy name. |
| PrismaCloud.Alert.policy.policyType | String | The type of policy. |
| PrismaCloud.Alert.policy.severity | String | The policy severity. |
| PrismaCloud.Alert.policy.recommendation | String | The policy recommendation. |
| PrismaCloud.Alert.policy.remediation.description | String | The policy remediation description. |
| PrismaCloud.Alert.policy.remediation.cliScriptTemplate | String | The policy remediation CLI script template. |
| PrismaCloud.Alert.policy.description | String | The policy description. |
| PrismaCloud.Alert.policy.labels | Unknown | The policy labels. |
| PrismaCloud.Alert.resource.cloudType | String | The resource cloud type. |
| PrismaCloud.Alert.resource.rrn | String | The restricted resource name. |
| PrismaCloud.Alert.resource.regionId | String | The resource region ID. |
| PrismaCloud.Alert.resource.url | String | The resource URL. |
| PrismaCloud.Alert.policy.remediable | Boolean | Whether the policy is remediable. |
| PrismaCloud.Alert.policy.systemDefault | Boolean | Whether the policy is the system default. |
| PrismaCloud.Alert.policy.deleted | Boolean | Whether the policy was deleted. |
Command example
!prisma-cloud-alert-get-details alert_id=P-465020
Context Example
{
"PrismaCloud": {
"Alert": {
"alertRules": [
{
"alertRuleNotificationConfig": [],
"allowAutoRemediate": false,
"enabled": true,
"name": "test",
"notifyOnDismissed": false,
"notifyOnOpen": true,
"notifyOnResolved": false,
"notifyOnSnoozed": false,
"policyScanConfigId": "policy-scan-config-id3",
"scanAll": true,
"target": {
"accountGroups": [],
"excludedAccounts": [],
"regions": [],
"tags": []
}
},
{
"alertRuleNotificationConfig": [],
"allowAutoRemediate": false,
"enabled": true,
"name": "Default Alert Rule",
"notifyOnDismissed": false,
"notifyOnOpen": true,
"notifyOnResolved": false,
"notifyOnSnoozed": false,
"policyScanConfigId": "policy-scan-config-id2",
"scanAll": false,
"target": {
"accountGroups": [],
"excludedAccounts": [],
"regions": [],
"tags": []
}
}
],
"alertTime": "2023-01-25T19:18:22Z",
"dismissalNote": "from XSOAR",
"dismissalUntilTs": -1,
"dismissedBy": "name@company.com",
"firstSeen": "2023-01-25T19:18:22Z",
"history": [
{
"modifiedBy": "name@company.com",
"modifiedOn": 1674987271011,
"reason": "NEW_ALERT",
"status": "open"
}
],
"id": "P-465020",
"lastSeen": "2023-01-29T10:14:31Z",
"metadata": {
"saveSearchId": "save-search-id1"
},
"networkAnomaly": false,
"policy": {
"complianceMetadata": [
{
"complianceId": "compliance-id1",
"customAssigned": false,
"policyId": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5",
"requirementId": "DSI",
"requirementName": "Data Security & Information Lifecycle Management",
"requirementViewOrder": 5,
"sectionDescription": "Data Inventory / Flows.",
"sectionId": "DSI-02",
"sectionLabel": "CSA CCM",
"sectionViewOrder": 25,
"standardDescription": "Cloud Security Alliance: Cloud Controls Matrix Version 3.0.1",
"standardName": "CSA CCM v3.0.1",
"systemDefault": true
},
{
"complianceId": "compliance-id2",
"customAssigned": false,
"policyId": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5",
"requirementId": "IAM",
"requirementName": "Identity & Access Management",
"requirementViewOrder": 10,
"sectionDescription": "Third Party Access.",
"sectionId": "IAM-07",
"sectionLabel": "CSA CCM",
"sectionViewOrder": 72,
"standardDescription": "Cloud Security Alliance: Cloud Controls Matrix Version 3.0.1",
"standardName": "CSA CCM v3.0.1",
"systemDefault": true
}
],
"deleted": false,
"description": "This policy identifies GCP VPC Network subnets have disabled Private Google access. Private Google access enables virtual machine instances on a subnet to reach Google APIs and services using an internal IP address rather than an external IP address. Internal (private) IP addresses are internal to Google Cloud Platform and are not routable or reachable over the Internet. You can use Private Google access to allow VMs without Internet access to reach Google APIs, services, and properties that are accessible over HTTP/HTTPS.",
"findingTypes": [],
"labels": [
"Policy Status Review"
],
"lastModifiedBy": "example@gmail.com",
"lastModifiedOn": 1664515792712,
"name": "GCP VPC Network subnets have Private Google access disabled",
"policyId": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5",
"policyType": "config",
"recommendation": "1. Login to GCP Portal\n2. Go to VPC network (Left Panel)\n3. Select VPC networks\n2. Click on the name of a reported subnet, The 'Subnet details' page will be displayed\n3. Click on 'EDIT' button\n4. Set 'Private Google access' to 'On'\n5. Click on Save",
"remediable": true,
"remediation": {
"cliScriptTemplate": "gcloud compute networks subnets update ${resourceName} --project=${account} --region ${region} --enable-private-ip-google-access",
"description": "This CLI command requires 'compute.networkAdmin' permission. Successful execution will enable GCP VPC Network subnets 'Private Google access'.",
"impact": "enables private-ip-google-access in GCP VPC Network subnets"
},
"severity": "medium",
"systemDefault": true
},
"reason": "USER_DISMISSED",
"resource": {
"account": "mail1@gmail.com",
"accountId": "panw-prisma-cloud",
"additionalInfo": {},
"cloudAccountGroups": [
"Default Account Group"
],
"cloudAccountOwners": [
"mail1@gmail.com"
],
"cloudServiceName": "Google VPC",
"cloudType": "gcp",
"data": {
"creationTimestamp": "2023-01-25T08:52:45.111-08:00",
"fingerprint": "a-fingerprint=",
"gatewayAddress": "1.1.1.1",
"id": "1111111111111111111",
"ipCidrRange": "1.1.1.1/20",
"kind": "compute#subnetwork",
"name": "boombox-network",
"network": "https://some-url",
"privateIpGoogleAccess": false,
"purpose": "PRIVATE",
"region": "https://some-url",
"selfLink": "https://some-url/subnetworks/boombox-network",
"stackType": "IPV4_ONLY"
},
"id": "1111111111111111111",
"internalResourceId": "11111111",
"name": "boombox-network",
"region": "GCP Belgium",
"regionId": "europe-west1",
"resourceApiName": "gcloud-compute-networks-subnets-list",
"resourceConfigJsonAvailable": true,
"resourceDetailsAvailable": true,
"resourceTs": 1676633361033,
"resourceType": "SUBNET",
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"unifiedAssetId": "unified-asset-id1"
},
"saveSearchId": "save-search-id3",
"status": "dismissed"
}
}
}
Human Readable Output
Alert P-465020 Details
Alert ID Reason Status Alert Time First Seen Last Seen Policy ID Policy Type Is Policy System Default Is Policy Remediable Policy Name Policy Recommendation Policy Description Policy Severity Policy Remediation Description Policy Remediation CLI Script Policy Labels Resource Type Resource Account Resource Cloud Type Resource RRN Resource ID Resource Account ID Resource Region ID Resource Api Name P-465020 USER_DISMISSED dismissed 2023-01-25T19:18:22Z 2023-01-25T19:18:22Z 2023-01-29T10:14:31Z a11b2cc3-1111-2222-33aa-a1b23ccc4dd5 config true true GCP VPC Network subnets have Private Google access disabled 1. Login to GCP Portal
2. Go to VPC network (Left Panel)
3. Select VPC networks
2. Click on the name of a reported subnet, The ‘Subnet details’ page will be displayed
3. Click on ‘EDIT’ button
4. Set ‘Private Google access’ to ‘On’
5. Click on SaveThis policy identifies GCP VPC Network subnets have disabled Private Google access. Private Google access enables virtual machine instances on a subnet to reach Google APIs and services using an internal IP address rather than an external IP address. Internal (private) IP addresses are internal to Google Cloud Platform and are not routable or reachable over the Internet. You can use Private Google access to allow VMs without Internet access to reach Google APIs, services, and properties that are accessible over HTTP/HTTPS. medium This CLI command requires ‘compute.networkAdmin’ permission. Successful execution will enable GCP VPC Network subnets ‘Private Google access’. gcloud compute networks subnets update ${resourceName} –project=${account} –region ${region} –enable-private-ip-google-access Policy Status Review SUBNET mail1@gmail.com gcp rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 1111111111111111111 panw-prisma-cloud europe-west1 gcloud-compute-networks-subnets-list
prisma-cloud-alert-filter-list
List the acceptable filters and values for alerts.
Base Command
prisma-cloud-alert-filter-list
Input
There are no input arguments for this command.
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AlertFilters.filterName | String | The filter name. |
| PrismaCloud.AlertFilters.options | String | The filter value options. |
| PrismaCloud.AlertFilters.staticFilter | Unknown | Whether the filter is static. |
Command example
#### Context Example
```json
{
"PrismaCloud": {
"AlertFilters": [
{
"filterName": "policy.name",
"options": [
"GCP Kubernetes Engine Clusters have Master authorized networks disabled"
],
"staticFilter": false
},
{
"filterName": "policy.type",
"options": [
"anomaly",
"audit_event",
"config",
"data",
"iam",
"network",
"workload_incident",
"workload_vulnerability"
],
"staticFilter": true
},
{
"filterName": "policy.label",
"options": [],
"staticFilter": false
},
{
"filterName": "policy.severity",
"options": [
"critical",
"high",
"medium",
"low",
"informational"
],
"staticFilter": true
},
{
"filterName": "policy.complianceStandard",
"options": [],
"staticFilter": false
},
{
"filterName": "policy.complianceRequirement",
"options": [],
"staticFilter": false
},
{
"filterName": "policy.complianceSection",
"options": [],
"staticFilter": false
},
{
"filterName": "cloud.account",
"options": [],
"staticFilter": false
},
{
"filterName": "account.group",
"options": [],
"staticFilter": false
},
{
"filterName": "cloud.region",
"options": [],
"staticFilter": false
},
{
"filterName": "alertRule.name",
"options": [],
"staticFilter": false
},
{
"filterName": "resource.id",
"options": [],
"staticFilter": false
},
{
"filterName": "resource.name",
"options": [],
"staticFilter": false
},
{
"filterName": "resource.type",
"options": [],
"staticFilter": false
},
{
"filterName": "resource.group",
"options": [],
"staticFilter": false
},
{
"filterName": "cloud.service",
"options": [],
"staticFilter": false
},
{
"filterName": "cloud.accountId",
"options": [],
"staticFilter": false
},
{
"filterName": "object.exposure",
"options": [
"private",
"public",
"conditional"
],
"staticFilter": true
},
{
"filterName": "malware",
"options": [
"true"
],
"staticFilter": true
},
{
"filterName": "object.classification",
"options": [],
"staticFilter": false
},
{
"filterName": "object.identifier",
"options": [],
"staticFilter": false
},
{
"filterName": "timeRange.type",
"options": [
"ALERT_STATUS_UPDATED",
"ALERT_UPDATED",
"ALERT_OPENED"
],
"staticFilter": true
},
{
"filterName": "vulnerability.severity",
"options": [
"all",
"high",
"critical",
"low",
"medium"
],
"staticFilter": true
},
{
"filterName": "buildtime.resourceName",
"options": [],
"staticFilter": false
},
{
"filterName": "git.filename",
"options": [],
"staticFilter": false
},
{
"filterName": "git.provider",
"options": [
"github",
"gitlab",
"bitbucket",
"perforce"
],
"staticFilter": false
},
{
"filterName": "git.repository",
"options": [],
"staticFilter": false
},
{
"filterName": "iac.framework",
"options": [
"ttt",
"CloudFormation"
],
"staticFilter": false
},
{
"filterName": "asset.class",
"options": [],
"staticFilter": false
},
{
"filterName": "alert.id",
"options": [],
"staticFilter": false
},
{
"filterName": "policy.subtype",
"options": [
"audit",
"build",
"data_classification",
"dns",
"identity",
"malware",
"network",
"network_config",
"network_event",
"permissions",
"run",
"run_and_build",
"ueba"
],
"staticFilter": true
},
{
"filterName": "alert.status",
"options": [
"dismissed",
"snoozed",
"open",
"resolved"
],
"staticFilter": true
},
{
"filterName": "cloud.type",
"options": [
"alibaba_cloud",
"aws",
"azure",
"gcp",
"oci"
],
"staticFilter": true
},
{
"filterName": "policy.remediable",
"options": [
"true",
"false"
],
"staticFilter": true
}
]
}
}
Human Readable Output
Filter Options
Filter Name Options Static Filter policy.name GCP Kubernetes Engine Clusters have Master authorized networks disabled false policy.type anomaly,
audit_event,
config,
data,
iam,
network,
workload_incident,
workload_vulnerabilitytrue policy.label false policy.severity critical,
high,
medium,
low,
informationaltrue policy.complianceStandard false policy.complianceRequirement false policy.complianceSection false cloud.account false account.group false cloud.region false alertRule.name false resource.id false resource.name false resource.type false resource.group false cloud.service false cloud.accountId false object.exposure private,
public,
conditionaltrue malware true true object.classification false object.identifier false timeRange.type ALERT_STATUS_UPDATED,
ALERT_UPDATED,
ALERT_OPENEDtrue vulnerability.severity all,
high,
critical,
low,
mediumtrue buildtime.resourceName false git.filename false git.provider github,
gitlab,
bitbucket,
perforcefalse git.repository false iac.framework ttt,
CloudFormationfalse asset.class false alert.id false policy.subtype audit,
build,
data_classification,
dns,
identity,
malware,
network,
network_config,
network_event,
permissions,
run,
run_and_build,
uebatrue alert.status dismissed,
snoozed,
open,
resolvedtrue cloud.type alibaba_cloud,
aws,
azure,
gcp,
ocitrue policy.remediable true,
falsetrue
prisma-cloud-remediation-command-list
Generates and returns a list of remediation commands for the specified alerts and policies. Data returned for a successful call include fully constructed commands for remediation. Either a policy ID or alert IDs must be provided. The returned information can be retrieved in the UI by clicking the “Remediate” button under the “Actions” column for supported alerts. When no absolute time nor relative time arguments are provided, the default time range is all times.
Base Command
prisma-cloud-remediation-command-list
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_ids | Comma-seperated list of alert IDs for which to get remediation details. Provided alert IDs must be associated with the same policy. If a policy is specified, all the alerts specified must belong to that policy. | Optional |
| policy_id | Policy ID for which to get remediation details. | Optional |
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AlertRemediation.description | String | Description of CLI remediation instructions. |
| PrismaCloud.AlertRemediation.scriptImpact | String | Impact of CLI remediation instructions. |
| PrismaCloud.AlertRemediation.alertId | String | The ID of the alert to which the remediation details apply. |
| PrismaCloud.AlertRemediation.CLIScript | String | The exact CLI command string. |
Command example
!prisma-cloud-remediation-command-list policy_id=a11b2cc3-1111-2222-33aa-a1b23ccc4dd5 limit=2
Context Example
{
"PrismaCloud": {
"Alert": {
"Remediation": [
{
"CLIScript": "aws rds modify-db-instance --db-instance-identifier aaaaaaaaaaaaaa --region us-east-1 --deletion-protection",
"alertId": "P-351515",
"description": "This CLI command requires 'rds:ModifyDBInstance' permission. Successful execution will enable deletion protection for the reported AWS RDS instance.",
"scriptImpact": null
},
{
"CLIScript": "aws rds modify-db-instance --db-instance-identifier bbbbbbbbbbbbbbb --region us-east-1 --deletion-protection",
"alertId": "P-351323",
"description": "This CLI command requires 'rds:ModifyDBInstance' permission. Successful execution will enable deletion protection for the reported AWS RDS instance.",
"scriptImpact": null
}
]
}
}
}
Human Readable Output
Showing 2 of 3 results:
Remediation Command List
CLI Script Alert Id Description aws rds modify-db-instance –db-instance-identifier aaaaaaaaaaaaaa –region us-east-1 –deletion-protection P-351515 This CLI command requires ‘rds:ModifyDBInstance’ permission. Successful execution will enable deletion protection for the reported AWS RDS instance. aws rds modify-db-instance –db-instance-identifier bbbbbbbbbbbbbbb –region us-east-1 –deletion-protection P-351323 This CLI command requires ‘rds:ModifyDBInstance’ permission. Successful execution will enable deletion protection for the reported AWS RDS instance.
prisma-cloud-alert-remediate
Remediates the alert with the specified ID, if that alert is associated with a remediable policy. In order to check what remediation would run, use the “prisma-cloud-remediation-command-list” command first.
Base Command
prisma-cloud-alert-remediate
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_id | The alert ID. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AlertRemediation.alertId | String | The ID of the alert to which the remediation apply. |
| PrismaCloud.AlertRemediation.successful | Boolean | Whether the remediation was successful. |
| PrismaCloud.AlertRemediation.failureReason | String | The failure reason for the remediation. |
| PrismaCloud.AlertRemediation.errorValue | String | The error value for the remediation. |
Command example
!prisma-cloud-alert-remediate alert_id=P-488074
Context Example
{
"PrismaCloud": {
"AlertRemediation": {
"alertId": "P-488074",
"successful": true
}
}
}
Human Readable Output
Alert P-488074 remediated successfully.
prisma-cloud-alert-reopen
Re-open the alerts matching the given filter. Either policy IDs or alert IDs must be provided. When no absolute time nor relative time arguments are provided, the default time range is all times.
Base Command
prisma-cloud-alert-reopen
Input
| Argument Name | Description | Required |
|---|---|---|
| alert_ids | Comma-separated list of alert IDs to be reopened. | Optional |
| policy_ids | Comma-separated list of policy IDs. | Optional |
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| filters | Comma-separated list of filter name and value, in the following format: filtername1=filtervalue1,filtername2=filtervalue2,etc. Names and possible values for filters can be found by running the “prisma-cloud-alert-filter-list” command. | Optional |
Context Output
There is no context output for this command.
Command example
!prisma-cloud-alert-reopen alert_ids=P-469663
Human Readable Output
Alerts re-opened successfully
prisma-cloud-alert-search
Search alerts on the Prisma Cloud platform. When no absolute time nor relative time arguments are provided, the search will show alerts from the last 7 days.
Base Command
prisma-cloud-alert-search
Input
| Argument Name | Description | Required |
|---|---|---|
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| filters | Comma-separated list of filter name and value, in the following format: filtername1=filtervalue1,filtername2=filtervalue2,etc. Names and possible values for filters can be found by running the “prisma-cloud-alert-filter-list” command. | Optional |
| detailed | Whether to retrieve the entire / trimmed alert model. Possible values are: true, false. Default is true. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| next_token | Token of the next page to retrive. When provided, other arguments are ignored. | Optional |
| sort_field | The field to sort the results by. Possible values are: alertTime,firstSeen,lastSeen,lastUpdated. | Optional |
| sort_direction | The direction to sort the results by. Sort field must be specified if sorting. Possible values are: asc, desc. Default is asc. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AlertPageToken.nextPageToken | String | Next page token. |
| PrismaCloud.Alert.id | String | The ID of the returned alert. |
| PrismaCloud.Alert.status | String | The status of the returned alert. |
| PrismaCloud.Alert.reason | String | The reason of the returned alert. |
| PrismaCloud.Alert.lastSeen | String | The time the returned alert was last seen. |
| PrismaCloud.Alert.firstSeen | String | The time the returned alert was first seen. |
| PrismaCloud.Alert.lastUpdated | String | The time the returned alert was last updated. |
| PrismaCloud.Alert.alertTime | String | The time of the returned alert. |
| PrismaCloud.Alert.policy.policyId | String | The policy ID of the returned alert. |
| PrismaCloud.Alert.policy.name | String | The policy name of the returned alert. |
| PrismaCloud.Alert.policy.policyType | String | The policy type of the returned alert. |
| PrismaCloud.Alert.policy.severity | String | The policy severity of the returned alert. |
| PrismaCloud.Alert.policy.remediable | Boolean | Whether the policy is remediable. |
| PrismaCloud.Alert.policy.description | String | The policy description of the returned alert. |
| PrismaCloud.Alert.policy.recommendation | String | The policy recommendation of the returned alert. |
| PrismaCloud.Alert.policy.remediation.description | String | The policy remediation description of the returned alert. |
| PrismaCloud.Alert.policy.remediation.cliScriptTemplate | String | The policy CLI script template description of the returned alert. |
| PrismaCloud.Alert.policy.systemDefault | Boolean | Whether the policy is the system default. |
| PrismaCloud.Alert.policy.deleted | Boolean | Whether the policy was deleted. |
| PrismaCloud.Alert.resource.resourceType | String | The resource type of the returned alert. |
| PrismaCloud.Alert.resource.name | String | The resource name of the returned alert. |
| PrismaCloud.Alert.resource.account | String | The resource account of the returned alert. |
| PrismaCloud.Alert.resource.cloudType | String | The resource cloud type of the returned alert. |
| PrismaCloud.Alert.resource.rrn | String | The restricted resource name of the returned alert. |
Command example
!prisma-cloud-alert-search filters=alert.status=open,policy.remediable=true,cloud.type=gcp,policy.type=config limit=2
Context Example
{
"PrismaCloud": {
"Alert": [
{
"alertRules": [],
"alertTime": "2023-02-17T12:57:46Z",
"firstSeen": "2023-02-17T12:57:46Z",
"history": [],
"id": "P-487678",
"lastSeen": "2023-02-17T12:57:46Z",
"lastUpdated": "2023-02-19T13:27:29Z",
"metadata": {
"saveSearchId": "save-search-id2"
},
"policy": {
"complianceMetadata": [
{
"complianceId": "compliance-id1",
"customAssigned": false,
"policyId": "policy-id2",
"requirementId": "DSI",
"requirementName": "Data Security & Information Lifecycle Management",
"requirementViewOrder": 5,
"sectionDescription": "Data Inventory / Flows.",
"sectionId": "DSI-02",
"sectionLabel": "CSA CCM",
"sectionViewOrder": 25,
"standardDescription": "Cloud Security Alliance: Cloud Controls Matrix Version 3.0.1",
"standardName": "CSA CCM v3.0.1",
"systemDefault": true
},
{
"complianceId": "compliance-id2",
"customAssigned": false,
"policyId": "policy-id4",
"requirementId": "IAM",
"requirementName": "Identity & Access Management",
"requirementViewOrder": 10,
"sectionDescription": "Third Party Access.",
"sectionId": "IAM-07",
"sectionLabel": "CSA CCM",
"sectionViewOrder": 72,
"standardDescription": "Cloud Security Alliance: Cloud Controls Matrix Version 3.0.1",
"standardName": "CSA CCM v3.0.1",
"systemDefault": true
}
],
"deleted": false,
"description": "This policy identifies GCP Firewall rule allowing all traffic on read-only port (12346) which exposes GKE clusters. In GKE, Kubelet exposes a read-only port 12346 which shows the configurations of all pods on the cluster at the /pods API endpoint. GKE itself does not expose this port to the Internet as the default project firewall configuration blocks external access. However, it is possible to inadvertently expose this port publicly on GKE clusters by creating a Google Compute Engine VPC firewall for GKE nodes that allows traffic from all source ranges on all the ports. This configuration publicly exposes all pod configurations, which might contain sensitive information.",
"findingTypes": [],
"labels": [],
"lastModifiedBy": "example@gmail.com",
"lastModifiedOn": 1649907869989,
"name": "GCP Firewall rule exposes GKE clusters by allowing all traffic on read-only port (12346)",
"policyId": "policy-id5",
"policyType": "config",
"recommendation": "As port 12345 exposes sensitive information of GKE pod configuration it is recommended to disable this firewall rule. \nOtherwise, remove the overly permissive source IPs following below steps,\n\n1. Login to GCP Console\n2. Navigate to 'VPC Network'(Left Panel)\n3. Go to the 'Firewall' section (Left Panel)\n4. Click on the reported Firewall rule\n5. Click on 'EDIT'\n6. Modify Source IP ranges to specific IP\n7. Click on 'SAVE'.",
"remediable": true,
"remediation": {
"cliScriptTemplate": "gcloud compute --project=${account} firewall-rules update ${resourceName} --disabled",
"description": "This CLI command requires 'compute.firewalls.update' and 'compute.networks.updatePolicy' permission. Successful execution will disable this firewall rule blocking internet traffic to port 12346.",
"impact": "Disable GCP Firewall rule which allows all traffic on read-only port (12345)"
},
"severity": "medium",
"systemDefault": true
},
"policyId": "policy-id7",
"reason": "NEW_ALERT",
"resource": {
"account": "Google Cloud Account",
"accountId": "AAAAAAA",
"additionalInfo": {},
"cloudAccountGroups": [
"Default Account Group"
],
"cloudAccountOwners": [
"mail1@gmail.com",
"example@gmail.com"
],
"cloudServiceName": "Google VPC",
"cloudType": "gcp",
"data": {
"allowed": [
{
"IPProtocol": "all"
}
],
"creationTimestamp": "2022-09-19T21:28:10.104-07:00",
"description": "",
"direction": "INGRESS",
"disabled": false,
"id": "666666666666666666",
"kind": "compute#firewall",
"logConfig": {
"enable": false
},
"name": "k8s",
"network": "https://some-url",
"priority": 1000,
"selfLink": "https://some-url",
"sourceRanges": [
"0.0.0.0/0"
]
},
"id": "3333333333333333333",
"name": "k8s",
"region": "global",
"regionId": "global",
"resourceApiName": "gcloud-compute-firewall-rules-list",
"resourceConfigJsonAvailable": true,
"resourceDetailsAvailable": true,
"resourceTs": 1676633555070,
"resourceType": "SECURITY_GROUP",
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"unifiedAssetId": "unifiedassetid2"
},
"saveSearchId": "save-search-id5",
"status": "open"
},
{
"alertRules": [],
"alertTime": "2023-02-17T12:57:46Z",
"firstSeen": "2023-02-17T12:57:46Z",
"history": [],
"id": "P-487768",
"lastSeen": "2023-02-17T12:57:46Z",
"lastUpdated": "2023-02-19T13:27:29Z",
"metadata": {
"saveSearchId": "save-search-id5"
},
"policy": {
"complianceMetadata": [
{
"complianceId": "compliance-id5",
"customAssigned": false,
"policyId": "policy-id-4",
"requirementId": "Section 404",
"requirementName": "Management Assessment",
"requirementViewOrder": 3,
"sectionDescription": "(b) Evaluation and Reporting.",
"sectionId": "Section 404.B",
"sectionLabel": "Section 404.B",
"sectionViewOrder": 9,
"standardDescription": "Management",
"standardName": "Management",
"systemDefault": true
}
],
"deleted": false,
"description": "This policy identifies GCP Firewall rule allowing all traffic on port 12345 which allows GKE full node access. The port 12345 on the kubelet is used by the kube-apiserver (running on hosts labelled as Orchestration Plane) for exec and logs. As per security best practice, port 12345 should not be exposed to the public.",
"findingTypes": [],
"labels": [],
"lastModifiedBy": "example@gmail.com",
"lastModifiedOn": 1652328910000,
"name": "GCP Firewall rule exposes GKE clusters by allowing all traffic on port 12345",
"policyId": "policy-id5",
"policyType": "config",
"recommendation": "As port 12345 exposes sensitive information of GKE pod configuration it is recommended to disable this firewall rule. \nOtherwise, remove the overly permissive source IPs following the below steps,\n\n1. Login to GCP Console\n2. Navigate to 'VPC Network'(Left Panel)\n3. Go to the 'Firewall' section (Left Panel)\n4. Click on the reported Firewall rule\n5. Click on 'EDIT'\n6. Modify Source IP ranges to specific IP\n7. Click on 'SAVE'.",
"remediable": true,
"remediation": {
"cliScriptTemplate": "gcloud compute --project=${account} firewall-rules update ${resourceName} --disabled",
"description": "This CLI command requires 'compute.firewalls.update' and 'compute.networks.updatePolicy' permission. Successful execution will disable this firewall rule blocking internet traffic to port 12345.",
"impact": "disable GCP Firewall rule that allows all traffic on port 12345"
},
"severity": "medium",
"systemDefault": true
},
"policyId": "policy-id-2",
"reason": "NEW_ALERT",
"resource": {
"account": "Google Cloud Account",
"accountId": "AAAAAAA",
"additionalInfo": {},
"cloudAccountGroups": [
"AAAAAAA",
"Default Account Group"
],
"cloudAccountOwners": [
"mail1@gmail.com",
"example@gmail.com"
],
"cloudServiceName": "Google VPC",
"cloudType": "gcp",
"data": {
"allowed": [
{
"IPProtocol": "all"
}
],
"creationTimestamp": "2022-09-19T21:28:10.104-07:00",
"description": "",
"direction": "INGRESS",
"disabled": false,
"id": "7777777777777777777",
"kind": "compute#firewall",
"logConfig": {
"enable": false
},
"name": "k8s",
"network": "https://some-url/global/networks/default",
"priority": 1000,
"selfLink": "https://some-url/global/firewalls/k8s",
"sourceRanges": [
"0.0.0.0/0"
]
},
"id": "7777777777777777777",
"name": "k8s",
"region": "global",
"regionId": "global",
"resourceApiName": "gcloud-compute-firewall-rules-list",
"resourceConfigJsonAvailable": true,
"resourceDetailsAvailable": true,
"resourceTs": 1676633555070,
"resourceType": "SECURITY_GROUP",
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"unifiedAssetId": "unifiedassetid6"
},
"saveSearchId": "save-search-id6",
"status": "open"
}
],
"AlertPageToken": {
"nextPageToken": "token"
}
}
}
Human Readable Output
Showing 2 of 25 results:
Alerts Details
Alert ID Reason Status Alert Time First Seen Last Seen Last Updated Policy ID Policy Type Is Policy System Default Is Policy Remediable Policy Name Is Policy Deleted Policy Recommendation Policy Description Policy Severity Policy Remediation Description Policy Remediation CLI Script Resource Type Resource Name Resource Account Resource Cloud Type Resource RRN P-487678 NEW_ALERT open 2023-02-17T12:57:46Z 2023-02-17T12:57:46Z 2023-02-17T12:57:46Z 2023-02-19T13:27:29Z policy-id7 config true true GCP Firewall rule exposes GKE clusters by allowing all traffic on read-only port (12346) false As port 12346 exposes sensitive information of GKE pod configuration it is recommended to disable this firewall rule.
Otherwise, remove the overly permissive source IPs following below steps,
1. Login to GCP Console
2. Navigate to ‘VPC Network’(Left Panel)
3. Go to the ‘Firewall’ section (Left Panel)
4. Click on the reported Firewall rule
5. Click on ‘EDIT’
6. Modify Source IP ranges to specific IP
7. Click on ‘SAVE’.This policy identifies GCP Firewall rule allowing all traffic on read-only port (12346) which exposes GKE clusters. In GKE, Kubelet exposes a read-only port 12346 which shows the configurations of all pods on the cluster at the /pods API endpoint. GKE itself does not expose this port to the Internet as the default project firewall configuration blocks external access. However, it is possible to inadvertently expose this port publicly on GKE clusters by creating a Google Compute Engine VPC firewall for GKE nodes that allows traffic from all source ranges on all the ports. This configuration publicly exposes all pod configurations, which might contain sensitive information. medium This CLI command requires ‘compute.firewalls.update’ and ‘compute.networks.updatePolicy’ permission. Successful execution will disable this firewall rule blocking internet traffic to port 12346. gcloud compute –project=${account} firewall-rules update ${resourceName} –disabled SECURITY_GROUP k8s Google Cloud Account gcp rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 P-487768 NEW_ALERT open 2023-02-17T12:57:46Z 2023-02-17T12:57:46Z 2023-02-17T12:57:46Z 2023-02-19T13:27:29Z policy-id-2 config true true GCP Firewall rule exposes GKE clusters by allowing all traffic on port 12345 false As port 12345 exposes sensitive information of GKE pod configuration it is recommended to disable this firewall rule.
Otherwise, remove the overly permissive source IPs following the below steps,
1. Login to GCP Console
2. Navigate to ‘VPC Network’(Left Panel)
3. Go to the ‘Firewall’ section (Left Panel)
4. Click on the reported Firewall rule
5. Click on ‘EDIT’
6. Modify Source IP ranges to specific IP
7. Click on ‘SAVE’.This policy identifies GCP Firewall rule allowing all traffic on port 12345 which allows GKE full node access. The port 12345 on the kubelet is used by the kube-apiserver (running on hosts labelled as Orchestration Plane) for exec and logs. As per security best practice, port 12345 should not be exposed to the public. medium This CLI command requires ‘compute.firewalls.update’ and ‘compute.networks.updatePolicy’ permission. Successful execution will disable this firewall rule blocking internet traffic to port 12345. gcloud compute –project=${account} firewall-rules update ${resourceName} –disabled SECURITY_GROUP k8s Google Cloud Account gcp rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 Next Page Token
token
prisma-cloud-config-search
Search configuration inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with “config”. When no absolute time nor relative time arguments are provided, the default time range is all times.
Base Command
prisma-cloud-config-search
Input
| Argument Name | Description | Required |
|---|---|---|
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| query | Query to run in Prisma Cloud config API using RQL language. For more information see: https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-rql-reference/rql-reference/config-query. | Required |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| search_id | Search ID. Can be used to rerun the same search. | Optional |
| sort_direction | The direction to sort the results by. Both sort direction and field must be specified if sorting. Possible values are: asc, desc. Default is desc. | Optional |
| sort_field | The field to sort the results by. Both sort direction and field must be specified if sorting. Possible values are: id, time, apiName, customerId, insertTs, json, cloudAccount, cloudRegion, stateId. Default is insertTs. | Optional |
| heuristic_search | Enable heuristic search optimization for faster results. Default is true. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Config.accountId | String | Cloud account ID. |
| PrismaCloud.Config.accountName | String | Cloud account name. |
| PrismaCloud.Config.allowDrillDown | Boolean | Whether to allow drill down. |
| PrismaCloud.Config.cloudType | String | Cloud type. |
| PrismaCloud.Config.deleted | Boolean | Whether the asset was deleted. |
| PrismaCloud.Config.hasExtFindingRiskFactors | Boolean | Whether the configuration has external finding risk factors. |
| PrismaCloud.Config.hasExternalFinding | Boolean | Whether the configuration has an external finding. |
| PrismaCloud.Config.hasExternalIntegration | Boolean | Whether the configuration has an external integration. |
| PrismaCloud.Config.hasNetwork | Boolean | Whether the configuration has a network. |
| PrismaCloud.Config.id | String | Prisma Cloud configuration ID. |
| PrismaCloud.Config.assetId | String | Prisma Cloud asset ID. |
| PrismaCloud.Config.data | Unknown | Prisma Cloud asset specific data. |
| PrismaCloud.Config.insertTs | Date | Insert timestamp. |
| PrismaCloud.Config.createdTs | Date | Created timestamp. |
| PrismaCloud.Config.name | String | Asset name. |
| PrismaCloud.Config.regionId | String | Cloud region ID. |
| PrismaCloud.Config.regionName | String | Cloud region name. |
| PrismaCloud.Config.resourceType | String | Cloud resource type. |
| PrismaCloud.Config.rrn | String | Cloud restricted resource name. |
| PrismaCloud.Config.service | String | Cloud service. |
| PrismaCloud.Config.stateId | String | State ID. |
Command example
!prisma-cloud-config-search query="config from cloud.resource where cloud.region = 'AWS Ohio' " limit=1
Context Example
{
"PrismaCloud": {
"Config": {
"accountId": "888888888888",
"accountName": "labs",
"allowDrillDown": true,
"assetId": "assetid1",
"cloudType": "aws",
"createdTs": "2023-02-17T11:07:40Z",
"data": {
"status": {
"isLogging": true,
"latestCloudWatchLogsDeliveryTime": "2023-02-19T13:27:38.122Z",
"latestDeliveryAttemptSucceeded": "2023-02-19T13:28:24Z",
"latestDeliveryAttemptTime": "2023-02-19T13:28:24Z",
"latestDeliveryTime": "2023-02-19T13:28:24.465Z",
"latestDigestDeliveryTime": "2023-02-19T12:40:04.109Z",
"latestNotificationAttemptSucceeded": "2023-02-19T13:28:24Z",
"latestNotificationAttemptTime": "2023-02-19T13:28:24Z",
"latestNotificationTime": "2023-02-19T13:28:24.461Z",
"logging": true,
"startLoggingTime": "2022-05-25T10:51:34.851Z",
"timeLoggingStarted": "2022-05-25T10:51:34Z",
"timeLoggingStopped": ""
},
"trail": "control"
},
"deleted": false,
"hasExtFindingRiskFactors": false,
"hasExternalFinding": false,
"hasExternalIntegration": false,
"hasNetwork": false,
"id": "arn:aws:trail:us-west-1:888888888888:trail/control",
"insertTs": "2023-02-19T13:29:28Z",
"name": "trail-status",
"regionId": "us-east-1",
"regionName": "AWS Ohio",
"resourceConfigJsonAvailable": true,
"resourceType": "Cloud Trail Status",
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"service": "AWS CloudTrail",
"stateId": "stateid3"
}
}
}
Human Readable Output
Showing 1 of 2925 results:
Configuration Details
Name Id Cloud Type Service Account Name Region Name Deleted Account Id Asset Id Created Ts Insert Ts Region Id Resource Type Rrn control-trail-status arn:aws:trail:us-west-1:888888888888:trail/control aws AWS CloudTrail labs AWS Ohio false 888888888888 assetid1 2023-02-17T11:07:40Z 2023-02-19T13:29:28Z us-east-2 Cloud Trail Status rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25
prisma-cloud-event-search
Search events inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with “event”. When no absolute time nor relative time arguments are provided, the default time range is all times.
Base Command
prisma-cloud-event-search
Input
| Argument Name | Description | Required |
|---|---|---|
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| query | Query to run in Prisma Cloud event API using RQL language. For more information see: https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-rql-reference/rql-reference/event-query. | Required |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| sort_field | The field to sort the results by. Possible values are: cloudService, operation, cloudAccount, cloudRegion, id, time, crud, user. | Optional |
| sort_direction | The direction to sort the results by. Sort field must be specified if sorting. Possible values are: asc, desc. Default is asc. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Event.subject | String | Cloud event subject. |
| PrismaCloud.Event.accountName | String | Cloud event account name. |
| PrismaCloud.Event.name | String | Cloud event name. |
| PrismaCloud.Event.source | String | Cloud event source. |
| PrismaCloud.Event.ip | String | Cloud event IP address. |
| PrismaCloud.Event.eventTs | Date | Cloud event timestamp. |
| PrismaCloud.Event.countryName | String | Cloud event country name. |
| PrismaCloud.Event.stateName | String | Cloud event state name. |
| PrismaCloud.Event.cityName | String | Cloud event city name. |
| PrismaCloud.Event.location | String | Cloud event location. |
| PrismaCloud.Event.account | String | Cloud event account. |
| PrismaCloud.Event.regionId | Number | Cloud event region ID. |
| PrismaCloud.Event.type | String | Cloud event type. |
| PrismaCloud.Event.id | Number | Cloud event ID. |
| PrismaCloud.Event.role | String | Cloud event role. |
| PrismaCloud.Event.accessKeyUsed | Boolean | Whether the cloud event access key is used. |
| PrismaCloud.Event.success | Boolean | Whether the cloud event is successful. |
| PrismaCloud.Event.internal | Boolean | Whether the cloud event is internal. |
| PrismaCloud.Event.cityId | Number | Cloud event city ID. |
| PrismaCloud.Event.cityLatitude | Number | Cloud event city latitude. |
| PrismaCloud.Event.cityLongitude | Number | Cloud event city longitude. |
| PrismaCloud.Event.countryId | Number | Cloud event country ID. |
| PrismaCloud.Event.dynamicData | String | Cloud event dynamic data. |
| PrismaCloud.Event.stateId | Number | Cloud event state ID. |
Command example
!prisma-cloud-event-search query="event from cloud.audit_logs where cloud.type = 'aws'" limit=2
Context Example
{
"PrismaCloud": {
"Event": [
{
"accessKeyUsed": false,
"account": "111111111111",
"accountName": "AAAAAAA",
"cityId": -3,
"cityLatitude": -1,
"cityLongitude": -1,
"cityName": "Internal",
"countryId": -3,
"countryName": "Internal",
"dynamicData": {},
"eventTs": "2022-10-17T00:00:26Z",
"id": 222222222,
"internal": false,
"location": "Internal",
"name": "StartBuild",
"notPersisted": false,
"regionId": 2,
"regionName": "AWS Ohio",
"role": "CloudWatchEventRule",
"source": "codebuild",
"stateId": -3,
"stateName": "Internal",
"subject": "Subject3",
"success": true,
"type": "CREATE"
},
{
"accessKeyUsed": false,
"account": "111111111111",
"accountName": "AAAAAAA",
"cityId": 4509177,
"cityLatitude": -1,
"cityLongitude": -1,
"cityName": "Columbus",
"countryId": 6251111,
"countryName": "United States of America",
"dynamicData": {},
"eventTs": "2022-10-17T00:03:07Z",
"id": 333333333,
"internal": false,
"ip": "1.1.1.1",
"location": "Columbus, Ohio, United States of America",
"name": "CreateReportGroup",
"notPersisted": false,
"regionId": 2,
"regionName": "AWS Ohio",
"role": "aws-codebuild-samples",
"source": "codebuild",
"stateId": 6666666,
"stateName": "Ohio",
"subject": "Subject6",
"success": false,
"type": "CREATE"
}
]
}
}
Human Readable Output
Showing 2 of 39018 results:
Event Details
Subject Account Name Name Source Ip Event Ts Country Name State Name City Name Location Account Region Id Type Id Role Access Key Used Success Internal Subject3 AAAAAAA StartBuild codebuild 2022-10-17T00:00:26Z Internal Internal Internal Internal 111111111111 2 CREATE 222222222 CloudWatchEventRule false true false Subject6 AAAAAAA CreateReportGroup codebuild 1.1.1.1 2022-10-17T00:03:07Z United States of America Ohio Columbus Columbus, Ohio, United States of America 111111111111 2 CREATE 333333333 aws-codebuild-samples false false false
prisma-cloud-network-search
Search networks inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with “networks”. When no absolute time nor relative time arguments are provided, the default time range is all times. In order to limit the results returning, use “limit search records to” at the end of the RQL query, followed by a value from one of these options: 1, 10, 100, 1000, and 10,000.
Base Command
prisma-cloud-network-search
Input
| Argument Name | Description | Required |
|---|---|---|
| time_range_date_from | Start time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_date_to | End time for the search. Time is interpreted as UTC. Values can be in either ISO date format, relative time, or epoch timestamp. For example: “2019-10-21T23:45:00 GMT+3” (ISO date format), “3 days” (relative time), 1579039377301 (epoch time). | Optional |
| time_range_unit | The search time unit. The “login” and “epoch” options are only available if “time_range_value” is not provided. Possible values are: hour, day, week, month, year, login, epoch. | Optional |
| time_range_value | The amount of “time_range_unit” to go back in time. For example, 3 days, 5 weeks, etc. | Optional |
| query | Query to run in Prisma Cloud network API using RQL language. For more information see: https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-rql-reference/rql-reference/network-query. | Required |
| cloud_type | The cloud in which the network should be searched. Possible values are: aws, azure, gcp, alibaba_cloud, oci. | Optional |
| search_id | Search ID. Can be used to rerun the same search. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Network.Node.id | Number | Cloud network node ID. |
| PrismaCloud.Network.Node.name | String | Cloud network node name. |
| PrismaCloud.Network.Node.ipAddr | String | Cloud network node IP address. |
| PrismaCloud.Network.Node.grouped | Boolean | Whether the cloud network node is grouped. |
| PrismaCloud.Network.Node.suspicious | Boolean | Whether the cloud network node is suspicious. |
| PrismaCloud.Network.Node.vulnerable | Boolean | Whether the cloud network node is vulnerable. |
| PrismaCloud.Network.Node.metadata | Unknown | Cloud network node metadata. |
| PrismaCloud.Network.Connection.from | Number | Cloud network connection from node ID. |
| PrismaCloud.Network.Connection.to | Number | Cloud network connection to node ID. |
| PrismaCloud.Network.Connection.label | String | Cloud network connection label. |
| PrismaCloud.Network.Connection.suspicious | Boolean | Whether the cloud network node is suspicious. |
| PrismaCloud.Network.Connection.metadata | Unknown | Cloud network connection metadata. |
Command example
!prisma-cloud-network-search query="network from vpc.flow_record where cloud.account = 'AWS Prod' AND source.publicnetwork IN ( 'Suspicious IPs' ) AND bytes > 0 "
Context Example
{
"PrismaCloud": {
"Network": {
"Connection": [
{
"from": -963693921,
"label": "Web & 1 more",
"metadata": {
"account_id": [
"888888888888"
],
"asset_role": [
"Suspicious IPs"
],
"bytes_accepted": 598088,
"bytes_attempted": 360,
"bytes_rejected": 0,
"cloud_type": [
"aws"
],
"connection_overview_table": [
{
"accepted": "yes",
"port": "Web (80)",
"traffic_volume": 565611
},
{
"accepted": "yes",
"port": "SSH (22)",
"traffic_volume": 32477
},
{
"accepted": "no",
"port": "Web (80)",
"traffic_volume": 360
}
],
"countries": [
"N/A"
],
"flow_class": [
"Web (80)",
"SSH (22)"
],
"from_ip_addresses": [
"0.0.0.0"
],
"isps": [
"N/A"
],
"region_id": [
"N/A"
],
"states": [
"N/A"
],
"suspicious_ips": [
"35.180.1.1",
"172.31.34.235"
],
"to_ip_addresses": [
"35.180.1.1",
"10.0.2.5"
]
},
"suspicious": true,
"to": -1695489264
}
],
"Node": [
{
"grouped": false,
"iconId": "web_server",
"id": -1695489264,
"ipAddr": "10.0.2.5",
"metadata": {
"account_id": [
"888888888888"
],
"account_name": [
"AWS Prod"
],
"asset_role": [
"VM Instance",
"SSH",
"Web Server"
],
"cloud_type": [
"aws"
],
"compliance_count": 0,
"guard_duty_host_count": 4,
"guard_duty_iam_count": 0,
"host_vulnerability_count": 0,
"initial": true,
"inspector_rba_count": 0,
"inspector_sbp_count": 0,
"instance_id": [
"i-0d"
],
"ip_addresses": [
"10.0.2.5"
],
"net_iface_id": [
"eni-08"
],
"redlock_alert_count": 10,
"region_id": [
"us-west-1"
],
"region_name": [
"AWS California"
],
"resource_id": [
"i-00"
],
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"secgroup_ids": [
"sg-0a"
],
"security_groups": [
{
"id": "sg-0a",
"name": "WebServersg"
}
],
"serverless_vulnerability_count": 0,
"tags": [
{
"name": "aws:cloudformation:stack-name",
"values": [
"aaa"
]
},
{
"name": "aws:cloudformation:stack-id",
"values": [
"arn:aws:trail:us-west-1:888888888888:trail/control"
]
},
{
"name": "aws:cloudformation:logical-id",
"values": [
"WebServerInstance"
]
},
{
"name": "Name",
"values": [
"PANW-WebServer"
]
}
],
"vpc_id": [
"vpc-07"
],
"vpc_name": [
{
"id": "vpc-07",
"name": "VPC-aaa"
}
]
},
"name": "PANW-WebServer",
"suspicious": false,
"vulnerable": true
},
{
"grouped": true,
"iconId": "suspicious",
"id": -963693921,
"ipAddr": "0.0.0.0",
"metadata": {
"account_id": [
"888888888888"
],
"account_name": [
"N/A"
],
"asset_role": [
"Suspicious IPs"
],
"bytes_accepted": 1368976,
"bytes_attempted": 2428,
"bytes_rejected": 0,
"cloud_type": [
"aws"
],
"compliance_count": 0,
"countries": [
"N/A"
],
"guard_duty_host_count": 0,
"guard_duty_iam_count": 0,
"host_vulnerability_count": 0,
"inspector_rba_count": 0,
"inspector_sbp_count": 0,
"instance_id": [
"N/A"
],
"ip_addresses": [
"N/A"
],
"isps": [
"N/A"
],
"launched_on": [
"N/A"
],
"net_iface_id": [
"N/A"
],
"redlock_alert_count": 0,
"region_id": [
"N/A"
],
"region_name": [
"N/A"
],
"resource_id": [
"N/A"
],
"secgroup_ids": [
"N/A"
],
"secgroup_names": [
"N/A"
],
"security_groups": [
"N/A"
],
"serverless_vulnerability_count": 0,
"specificIps": [
"172.31.34.235",
"1.1.1.1"
],
"states": [
"N/A"
],
"tags": [
"N/A"
],
"vpc_name": [
"N/A"
]
},
"name": "Suspicious IPs",
"suspicious": false,
"vulnerable": false
}
]
}
}
}
Human Readable Output
Network Details
Nodes
Id Name Ip Addr Grouped Suspicious Vulnerable -1695489264 PANW-WebServer 10.0.2.5 false false true -963693921 Suspicious IPs 0.0.0.0 true false false Connections
From To Label Suspicious -963693921 -1695489264 Web & 1 more true
prisma-cloud-error-file-list
Deprecated, use the prisma-cloud-code-issues-list command instead.
prisma-cloud-trigger-scan
Trigger asynchronous scan of all resources to refresh the current state at Prisma Cloud Code Security. In order to use this command, the “Code Security” module needs to be enabled and accessible in the Prisma Cloud UI.
Base Command
prisma-cloud-trigger-scan
Input
There are no input arguments for this command.
Context Output
There is no context output for this command.
Command example
#### Human Readable Output
>### Trigger Scan Results
>
>|Is Executed|Message|
>|---|---|
>| false | Executing a new scan has failed - a scheduled scan is already in progress. |
### prisma-cloud-resource-get
***
Get resource details.
#### Base Command
`prisma-cloud-resource-get`
#### Input
| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| rrn | Restricted Resource Name of the resource to get details about. Can be retrieved by running a command that has that RRN. | Required |
#### Context Output
| **Path** | **Type** | **Description** |
| --- | --- | --- |
| PrismaCloud.Resource.rrn | String | Prisma Cloud restricted resource name. |
| PrismaCloud.Resource.id | String | Prisma Cloud resource ID. |
| PrismaCloud.Resource.name | String | Resource name. |
| PrismaCloud.Resource.url | String | Resource URL. |
| PrismaCloud.Resource.accountId | String | Cloud account ID. |
| PrismaCloud.Resource.accountName | String | Cloud account name. |
| PrismaCloud.Resource.cloudType | String | Cloud type. |
| PrismaCloud.Resource.regionId | String | Cloud region ID. |
| PrismaCloud.Resource.regionName | String | Cloud region Name. |
| PrismaCloud.Resource.service | String | Cloud service. |
| PrismaCloud.Resource.resourceType | String | Cloud resource type. |
| PrismaCloud.Resource.insertTs | Date | Insert timestamp. |
| PrismaCloud.Resource.deleted | Boolean | Whether the resource was deleted. |
| PrismaCloud.Resource.vpcId | String | VPC ID. |
| PrismaCloud.Resource.vpcName | String | VPC name. |
| PrismaCloud.Resource.tags | Unknown | Prisma Cloud resource tags. |
| PrismaCloud.Resource.riskGrade | String | Risk grade. |
| PrismaCloud.Resource.hasNetwork | Boolean | Whether the resource has a network. |
| PrismaCloud.Resource.hasExternalFinding | Boolean | Whether the resource has an external finding. |
| PrismaCloud.Resource.hasExternalIntegration | Boolean | Whether the resource has an external integration. |
| PrismaCloud.Resource.allowDrillDown | Boolean | Whether to allow drill down. |
| PrismaCloud.Resource.hasExtFindingRiskFactors | Boolean | Whether the resource has external finding risk factors. |
| PrismaCloud.Resource.data | Unknown | Prisma Cloud resource specific data. |
#### Command example
```!prisma-cloud-resource-get rrn=rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25```
#### Context Example
```json
{
"PrismaCloud": {
"Resource": {
"accountId": "111111111111",
"accountName": "AAAAAAA",
"allowDrillDown": true,
"cloudType": "aws",
"data": {
"attributes": [
{
"attributeName": "restore",
"attributeValues": []
}
],
"snapshot": {
"allocatedStorage": 20,
"availabilityZone": "us-east-1a",
"dbiResourceId": "db-S",
"dbinstanceIdentifier": "aaaaaaaaaaaaaa",
"dbsnapshotArn": "arn:aws:trail:us-west-1:888888888888:trail/control",
"dbsnapshotIdentifier": "rds:aaaaaaaaaaaaaa-2023-01-29-09-25",
"encrypted": false,
"engine": "postgres",
"engineVersion": "13.7",
"iamdatabaseAuthenticationEnabled": false,
"instanceCreateTime": "2022-07-22T18:35:54.809Z",
"licenseModel": "postgresql-license",
"masterUsername": "master",
"optionGroupName": "default:postgres-13",
"originalSnapshotCreateTime": "2023-01-29T09:25:08.698Z",
"percentProgress": 100,
"port": 5432,
"processorFeatures": [],
"snapshotCreateTime": "2023-01-29T09:25:08.698Z",
"snapshotTarget": "region",
"snapshotType": "automated",
"status": "available",
"storageThroughput": 0,
"storageType": "standard",
"tagList": [],
"vpcId": "vpc-0f"
},
"tags": []
},
"deleted": true,
"hasExtFindingRiskFactors": false,
"hasExternalFinding": false,
"hasExternalIntegration": false,
"hasNetwork": false,
"id": "rds:aaaaaaaaaaaaaa-2023-01-29-09-25",
"insertTs": "2023-01-29T09:35:27Z",
"name": "rds:aaaaaaaaaaaaaa-2023-01-29-09-25",
"regionId": "us-east-1",
"regionName": "AWS Virginia",
"resourceConfigJsonAvailable": false,
"resourceType": "Managed Database Snapshot",
"riskGrade": "A",
"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"service": "Amazon RDS",
"tags": {
"": ""
},
"url": "https://some-url?region=us-east-1#db-snapshots:id=rds:aaaaaaaaaaaaaa-2023-01-29-09-25",
"vpcId": "vpc-0f",
"vpcName": "ServerlessVPC"
}
}
}
Human Readable Output
Resource Details
Rrn Id Name Url Account Id Account Name Cloud Type Region Id Region Name Service Resource Type Insert Ts Deleted Vpc Id Vpc Name Tags Risk Grade Has Network Has External Finding Has External Integration Allow Drill Down Has Ext Finding Risk Factors rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 rds:aaaaaaaaaaaaaa-2023-01-29-09-25 rds:aaaaaaaaaaaaaa-2023-01-29-09-25 https://some_url?region=us-east-1#db-snapshots:id=rds:aaaaaaaaaaaaaa-2023-01-29-09-25 111111111111 AAAAAAA aws us-east-1 AWS Virginia Amazon RDS Managed Database Snapshot 2023-01-29T09:35:27Z true vpc-0f ServerlessVPC : A false false false true false
prisma-cloud-resource-list
Returns all the resource lists. Maps to the Resource Lists under Settings > Resource Lists in the Console UI.
Base Command
prisma-cloud-resource-list
Input
| Argument Name | Description | Required |
|---|---|---|
| list_type | The resource list type. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.ResourceList.id | String | Prisma Cloud resource list ID. |
| PrismaCloud.ResourceList.name | String | Resource list name. |
| PrismaCloud.ResourceList.resourceListType | String | Resource list type. |
| PrismaCloud.ResourceList.description | String | Resource list description. |
| PrismaCloud.ResourceList.lastModifiedBy | String | Resource list last modified user. |
| PrismaCloud.ResourceList.lastModifiedTs | Date | Resource list last modified time. |
| PrismaCloud.ResourceList.members | Unknown | Resource list members. |
Command example
!prisma-cloud-resource-list limit=3
Context Example
{
"PrismaCloud": {
"ResourceList": [
{
"description": null,
"id": "aa11bb22",
"lastModifiedBy": "admin@paloaltonetworks.com",
"lastModifiedTs": "2021-09-20T16:23:15Z",
"members": [
{
"demo": "lab"
},
{
"dev": "prisma"
},
{
"env": "lab"
}
],
"name": "First",
"resourceListType": "TAG"
},
{
"description": null,
"id": "aa22bb11",
"lastModifiedBy": "admin2@paloaltonetworks.com",
"lastModifiedTs": "2023-03-10T04:54:34Z",
"members": [
{
}
],
"name": "other",
"resourceListType": "COMPUTE_ACCESS_GROUP"
},
{
"description": null,
"id": "a3b4",
"lastModifiedBy": "test@paloaltonetworks.com",
"lastModifiedTs": "2023-07-10T22:27:55Z",
"members": [
{
"labels": [
"*"
],
"namespaces": [
"*"
]
}
],
"name": "panw",
"resourceListType": "COMPUTE_ACCESS_GROUP"
}
]
}
}
Human Readable Output
Showing 3 of 6 results:
Resources Details
Name Id Type Last Modified By First aa11bb22 TAG admin@paloaltonetworks.com other aa22bb11 COMPUTE_ACCESS_GROUP admin2@paloaltonetworks.com panw a3b4 COMPUTE_ACCESS_GROUP test@paloaltonetworks.com
prisma-cloud-user-roles-list
Retrieves user roles. Maps to Settings > Access Control > Roles in the Console UI.
Base Command
prisma-cloud-user-roles-list
Input
| Argument Name | Description | Required |
|---|---|---|
| role_id | The role id to get details of. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.UserRoles.id | String | Prisma Cloud user roles ID. |
| PrismaCloud.UserRoles.name | String | User roles name. |
| PrismaCloud.UserRoles.resourceListIds | Unknown | User roles resource list IDs. |
| PrismaCloud.UserRoles.description | String | User roles description. |
| PrismaCloud.UserRoles.lastModifiedBy | String | User roles last modified user. |
| PrismaCloud.UserRoles.lastModifiedTs | Date | User roles last modified time. |
| PrismaCloud.UserRoles.associatedUsers | Unknown | User roles associated users. |
| PrismaCloud.UserRoles.restrictDismissalAccess | Boolean | Whether dismissal access is restricted for the user role. |
| PrismaCloud.UserRoles.roleType | String | User roles role type. |
| PrismaCloud.UserRoles.additionalAttributes | Unknown | User roles additional attributes. |
| PrismaCloud.UserRoles.codeRepositoryIds | Unknown | User roles code repository IDs. |
| PrismaCloud.UserRoles.accountGroupIds | Unknown | User roles account group IDs. |
| PrismaCloud.UserRoles.resourceLists | Unknown | User roles resource lists. |
| PrismaCloud.UserRoles.permissionGroup | Unknown | User roles permission group. |
| PrismaCloud.UserRoles.codeRepositories | Unknown | User roles code repositories. |
| PrismaCloud.UserRoles.accountGroups | Unknown | User roles account groups. |
Command example
!prisma-cloud-user-roles-list limit=3
Context Example
{
"PrismaCloud": {
"UserRoles": [
{
"accountGroupIds": [],
"accountGroups": [],
"additionalAttributes": {
"hasDefenderPermissions": false,
"onlyAllowCIAccess": false,
"onlyAllowComputeAccess": false,
"onlyAllowReadAccess": false
},
"associatedUsers": [
"lab",
"demo"
],
"codeRepositories": [],
"codeRepositoryIds": [],
"description": "",
"id": "a2b2",
"lastModifiedBy": "test@paloaltonetworks.com",
"lastModifiedTs": "2023-08-02T17:47:07Z",
"name": "dev-test",
"permissionGroup": null,
"resourceListIds": [],
"resourceLists": [],
"restrictDismissalAccess": true,
"roleType": "Developer"
},
{
"accountGroupIds": [],
"accountGroups": [],
"additionalAttributes": {
"hasDefenderPermissions": false,
"onlyAllowCIAccess": false,
"onlyAllowComputeAccess": false,
"onlyAllowReadAccess": false
},
"associatedUsers": [
"test"
],
"codeRepositories": [],
"codeRepositoryIds": [],
"description": "",
"id": "a3b3",
"lastModifiedBy": "admin@paloaltonetworks.com",
"lastModifiedTs": "2023-07-21T15:27:04Z",
"name": "Custom Read Only",
"permissionGroup": null,
"resourceListIds": [],
"resourceLists": [],
"restrictDismissalAccess": false,
"roleType": "Custom Read Only"
},
{
"accountGroupIds": [
"aaa111",
"bbb222"
],
"accountGroups": [
{
"id": "aaa111",
"name": "group1"
},
{
"id": "bbb222",
"name": "group2"
}
],
"additionalAttributes": {
"hasDefenderPermissions": false,
"onlyAllowCIAccess": false,
"onlyAllowComputeAccess": false,
"onlyAllowReadAccess": true
},
"associatedUsers": [
"user1",
"user2"
],
"codeRepositories": [
{
"id": "a3c3",
"name": "demo"
}
],
"codeRepositoryIds": [
"a3c3"
],
"description": "",
"id": "a4b4",
"lastModifiedBy": "test@paloaltonetworks.com",
"lastModifiedTs": "2023-07-18T19:27:59Z",
"name": "Read Only",
"permissionGroup": null,
"resourceListIds": [],
"resourceLists": [],
"restrictDismissalAccess": true,
"roleType": "Account Group Read Only"
}
]
}
}
Human Readable Output
Showing 3 of 14 results:
User Roles Details
Name Id Role Type dev-test a2b2 Developer Custom Read Only a3b3 Custom Read Only Read Only a4b4 Account Group Read Only
prisma-cloud-users-list
Lists all users and service accounts for your tenant. Maps to Settings > Access Control > Users in the Console UI.
Base Command
prisma-cloud-users-list
Input
| Argument Name | Description | Required |
|---|---|---|
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
| usernames | Usernames to return only users associated with. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Users.email | String | Prisma Cloud user email. |
| PrismaCloud.Users.firstName | String | User first name. |
| PrismaCloud.Users.lastName | String | User last name. |
| PrismaCloud.Users.timeZone | String | User time zone. |
| PrismaCloud.Users.enabled | Boolean | User enabled. |
| PrismaCloud.Users.lastModifiedBy | String | User last modified user. |
| PrismaCloud.Users.lastModifiedTs | Date | User last modified time. |
| PrismaCloud.Users.lastLoginTs | Date | User last login time. |
| PrismaCloud.Users.displayName | String | User display name. |
| PrismaCloud.Users.ssoBypassAllowed | Boolean | Whether SSO bypass is allowed for the user role. |
| PrismaCloud.Users.accessKeysAllowed | Boolean | Whether access keys are allowed for the user role. |
| PrismaCloud.Users.defaultRoleId | String | User default role ID. |
| PrismaCloud.Users.roleIds | Unknown | User role IDs. |
| PrismaCloud.Users.roles | Unknown | User roles. |
| PrismaCloud.Users.username | String | User username. |
| PrismaCloud.Users.type | String | User type. |
| PrismaCloud.Users.enableKeyExpiration | Boolean | Whether key expiration is enabled for the user role. |
| PrismaCloud.Users.accessKeysCount | Number | User access keys count. |
Command example
!prisma-cloud-users-list limit=2
Context Example
{
"PrismaCloud": {
"Users": [
{
"accessKeysAllowed": false,
"accessKeysCount": 0,
"defaultRoleId": "a4b4",
"displayName": "User Test",
"email": "test@paloaltonetworks.com",
"enableKeyExpiration": false,
"enabled": true,
"firstName": "User",
"lastLoginTs": "1969-12-31T23:59:59Z",
"lastModifiedBy": "admin@paloaltonetworks.com",
"lastModifiedTs": "2020-01-21T22:35:36Z",
"lastName": "Test",
"roleIds": [
"a4b4"
],
"roles": [
{
"id": "a4b4",
"name": "Read Only",
"onlyAllowCIAccess": false,
"onlyAllowComputeAccess": false,
"onlyAllowReadAccess": true,
"type": "Account Group Read Only"
}
],
"roles names": [
"Read Only"
],
"ssoBypassAllowed": false,
"timeZone": "America/New_York",
"type": "USER_ACCOUNT",
"username": "test@paloaltonetworks.com"
},
{
"accessKeysAllowed": false,
"accessKeysCount": 0,
"defaultRoleId": "a4b4",
"displayName": "User Other",
"email": "other@paloaltonetworks.com",
"enableKeyExpiration": false,
"enabled": true,
"firstName": "User",
"lastLoginTs": "2023-08-29T14:04:17Z",
"lastModifiedBy": "USER-ADD",
"lastModifiedTs": "2023-08-29T13:45:06Z",
"lastName": "Other",
"roleIds": [
"a4b4"
],
"roles": [
{
"id": "a4b4",
"name": "Read Only",
"onlyAllowCIAccess": false,
"onlyAllowComputeAccess": false,
"onlyAllowReadAccess": true,
"type": "Account Group Read Only"
}
],
"roles names": [
"Read Only"
],
"ssoBypassAllowed": false,
"timeZone": "America/New_York",
"type": "USER_ACCOUNT",
"username": "other@paloaltonetworks.com"
}
]
}
}
Human Readable Output
Showing 2 of 200 results:
Users Details
Display Name Enabled Username Type Roles Names User Test test@paloaltonetworks.com true test@paloaltonetworks.com USER_ACCOUNT Read Only User Other other@paloaltonetworks.com true other@paloaltonetworks.com USER_ACCOUNT Read Only
prisma-cloud-account-list
List accounts.
Base Command
prisma-cloud-account-list
Input
| Argument Name | Description | Required |
|---|---|---|
| exclude_account_group_details | Whether to exclude account group details. Possible values are: true, false. Default is false. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Account.name | String | Account name. |
| PrismaCloud.Account.cloudType | String | Account cloud type. |
| PrismaCloud.Account.accountType | String | Account type. |
| PrismaCloud.Account.enabled | Boolean | Whether the account is enabled. |
| PrismaCloud.Account.lastModifiedTs | Date | Account last modified time. |
| PrismaCloud.Account.storageScanEnabled | Boolean | Whether account storage scan is enabled. |
| PrismaCloud.Account.protectionMode | String | Account protection mode. |
| PrismaCloud.Account.ingestionMode | Number | Account ingestion mode. |
| PrismaCloud.Account.deploymentType | String | Account deployment type. |
| PrismaCloud.Account.groupIds | Unknown | Account group IDs. |
| PrismaCloud.Account.groups | Unknown | Account groups. |
| PrismaCloud.Account.status | String | Account status. |
| PrismaCloud.Account.numberOfChildAccounts | Number | The number of child accounts. |
| PrismaCloud.Account.accountId | String | Account ID. |
| PrismaCloud.Account.addedOn | Date | Account added on time. |
Command example
!prisma-cloud-account-list limit=1
Context Example
{
"PrismaCloud": {
"Account": [
{
"accountId": "777777777777",
"accountType": "organization",
"addedOn": "2022-10-06T04:06:41Z",
"cloudAccountOwner": "mail1@gmail.com",
"cloudAccountOwnerCount": 1,
"cloudType": "aws",
"deploymentType": "aws",
"enabled": true,
"groupIds": [
"group2"
],
"groups": [
{
"id": "group2",
"name": "Adi"
}
],
"ingestionMode": 7,
"lastModifiedBy": "example@example.com",
"lastModifiedTs": "2022-10-06T12:48:42Z",
"name": "aws-Adi-train",
"numberOfChildAccounts": 4,
"protectionMode": "MONITOR_AND_PROTECT",
"status": "warning",
"storageScanEnabled": false
}
]
}
}
Human Readable Output
Showing 1 of 19 results:
Accounts Details
Account Id Name Cloud Type Account Type Enabled Added On Last Modified Ts Last Modified By Storage Scan Enabled Protection Mode Ingestion Mode Deployment Type Status 777777777777 aws-Adi-train aws organization true 2022-10-06T04:06:41Z 2022-10-06T12:48:42Z example@example.com false MONITOR_AND_PROTECT 7 aws warning
prisma-cloud-account-status-get
Get the statuses of the provided accounts.
Base Command
prisma-cloud-account-status-get
Input
| Argument Name | Description | Required |
|---|---|---|
| account_ids | A comma-separated list of accound IDs. To get account IDs, run the “prisma-cloud-account-list” command. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Account.accountId | String | Account ID. |
| PrismaCloud.Account.name | String | Account name. |
| PrismaCloud.Account.status | String | Account status. |
| PrismaCloud.Account.message | String | Account message. |
| PrismaCloud.Account.remediation | String | Account remediation action. |
Command example
!prisma-cloud-account-status-get account_ids=111111111111
Context Example
{
"PrismaCloud": {
"Account": {
"accountId": "111111111111",
"message": "",
"name": "Config",
"remediation": "",
"status": "ok",
"subComponents": []
}
}
}
Human Readable Output
Accounts Status Details
Account Id Name Status 111111111111 Config ok
prisma-cloud-account-owner-list
Get the owners of the provided accounts.
Base Command
prisma-cloud-account-owner-list
Input
| Argument Name | Description | Required |
|---|---|---|
| account_ids | A comma-separated list of account IDs. To get account IDs, run the “prisma-cloud-account-list” command. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Account.accountId | String | Account ID. |
| PrismaCloud.Account.emails | Unknown | Account owner emails. |
Command example
!prisma-cloud-account-owner-list account_ids=888888888888888888888888888888888888,111111111111
Context Example
{
"PrismaCloud": {
"Account": [
{
"accountId": "888888888888888888888888888888888888",
"emails": [
"name@company.com"
]
},
{
"accountId": "111111111111",
"emails": []
}
]
}
}
Human Readable Output
Accounts Owner Details
Account Id Emails 888888888888888888888888888888888888 name@company.com 111111111111
prisma-cloud-host-finding-list
Get resource host finding list.
Base Command
prisma-cloud-host-finding-list
Input
| Argument Name | Description | Required |
|---|---|---|
| rrn | Restricted Resource Name of the resource to get host finding of. Can be retrieved by running a command that has that RRN. | Required |
| finding_types | Comma separated list of finding types to look for. Available options are: guard_duty_host, guard_duty_iam, inspector_sbp, compliance_cis, host_vulnerability_cve. When left empty, will return all options. | Optional |
| risk_factors | Comma separated list of risk factors to look for. Available options are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE. When left empty, will return all options. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| all_results | Whether to retrieve all results. The “limit” argument will be ignored. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.HostFinding.accountId | String | Host finding account ID. |
| PrismaCloud.HostFinding.regionId | String | Host finding region ID. |
| PrismaCloud.HostFinding.findingId | String | Host finding ID. |
| PrismaCloud.HostFinding.type | String | Host finding type. |
| PrismaCloud.HostFinding.source | String | Host finding source. |
| PrismaCloud.HostFinding.severity | String | Host finding severity. |
| PrismaCloud.HostFinding.status | String | Host finding status. |
| PrismaCloud.HostFinding.createdOn | Date | The date on which the host finding was created. |
| PrismaCloud.HostFinding.updatedOn | Date | The date on which the host finding was updated. |
| PrismaCloud.HostFinding.normalizedNames | Unknown | Host finding normalized names. |
| PrismaCloud.HostFinding.scanId | String | Host finding scan ID. |
| PrismaCloud.HostFinding.resourceCloudId | String | Host finding resource cloud ID. |
| PrismaCloud.HostFinding.sourceData.accountId | String | Host finding source data account ID. |
| PrismaCloud.HostFinding.sourceData.arn | String | Host finding source data ARN. |
| PrismaCloud.HostFinding.title | String | Host finding title. |
| PrismaCloud.HostFinding.description | String | Host finding description. |
| PrismaCloud.HostFinding.resourceUrl | String | Host finding resource URL. |
| PrismaCloud.HostFinding.rlUpdatedOn | Date | The date on which the RL was updated. |
| PrismaCloud.HostFinding.externalFindingId | String | External finding ID. |
| PrismaCloud.HostFinding.sourceData | Unknown | Host finding source data. |
| PrismaCloud.HostFinding.score | String | Host finding score. |
| PrismaCloud.HostFinding.count | Number | The number of host findings. |
Command example
!prisma-cloud-host-finding-list rrn=rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 finding_types=guard_duty_host,guard_duty_iam limit=2
Context Example
{
"PrismaCloud": {
"HostFinding": {
"accountId": "555555555555",
"count": "5",
"createdOn": "2023-01-03T16:13:25Z",
"description": "35.180.1.1 is performing SSH brute force attacks against i-44444444444444444. Brute force attacks are used to gain unauthorized access to your instance by guessing the SSH password.",
"externalFindingId": 999999,
"findingId": "findingid3",
"normalizedNames": [
"UnauthorizedAccess:EC2/SSHBruteForce"
],
"regionId": "us-east-1",
"resourceCloudId": "i-44444444444444444",
"resourceUrl": "https://some-url?#/findings?search=id%3D66666666666666666666666666666666",
"rlUpdatedOn": "2023-02-16T16:27:26Z",
"scanId": "scan-id-5",
"score": "N/A",
"severity": "low",
"source": "guardduty",
"sourceData": {
"accountId": "555555555555",
"arn": "arn:aws:trail:us-west-1:888888888888:trail/control",
"createdAt": "2023-01-03T16:13:25.421Z",
"description": "35.180.1.1 is performing SSH brute force attacks against i-44444444444444444. Brute force attacks are used to gain unauthorized access to your instance by guessing the SSH password.",
"id": "66666666666666666666666666666666",
"partition": "aws",
"region": "us-east-1",
"resource": {
"instanceDetails": {
"availabilityZone": "us-east-1a",
"iamInstanceProfile": {
"arn": "arn:aws:trail:us-west-1:888888888888:trail/control",
"id": "A2"
},
"imageDescription": "Amazon Linux AMI 2.0.20222202 x86_64 ECS HVM GP2",
"imageId": "ami-2",
"instanceId": "i-44444444444444444",
"instanceState": "running",
"instanceType": "t2.xlarge",
"launchTime": "2022-12-13T01:29:18.000Z",
"networkInterfaces": [
{
"ipv6Addresses": [],
"networkInterfaceId": "eni-1",
"privateDnsName": "ip-1-1-1-1.ec2.internal",
"privateIpAddress": "1.1.1.1",
"privateIpAddresses": [
{
"privateDnsName": "ip-1-1-1-1.ec2.internal",
"privateIpAddress": "1.1.1.1"
}
],
"publicDnsName": "ec2-5.compute-1.amazonaws.com",
"publicIp": "1.1.1.1",
"sgs": [
{
"groupId": "sg-000",
"groupName": "security-group"
}
],
"subnetId": "subnet-0",
"vpcId": "vpc-01"
}
],
"productCodes": [],
"tags": [
{
"key": "aws:autoscaling:groupName",
"value": "pc-infra-autoscaling"
}
]
},
"resourceType": "Instance"
},
"schemaVersion": "2.0",
"service": {
"action": {
"actionType": "NETWORK_CONNECTION",
"networkConnectionAction": {
"blocked": false,
"connectionDirection": "INBOUND",
"localIpDetails": {
"ipAddressV4": "1.1.1.1"
},
"localPortDetails": {
"port": 22,
"portName": "SSH"
},
"protocol": "TCP",
"remoteIpDetails": {
"city": {
"cityName": "George Town"
},
"country": {
"countryName": "Malaysia"
},
"geoLocation": {
"lat": 5.4244,
"lon": 100.333
},
"ipAddressV4": "35.180.1.1",
"organization": {
"asn": "9999",
"asnOrg": "TIME",
"isp": "TIME",
"org": "TIME"
}
},
"remotePortDetails": {
"port": 33333,
"portName": "Unknown"
}
}
},
"additionalInfo": {
"type": "default",
"value": "{}"
},
"archived": false,
"count": 5,
"detectorId": "scan-id-5",
"eventFirstSeen": "2023-01-03T15:56:55.000Z",
"eventLastSeen": "2023-02-16T15:53:32.000Z",
"resourceRole": "TARGET",
"serviceName": "guardduty"
},
"severity": 2,
"title": "35.180.1.1 is performing SSH brute force attacks against i-44444444444444444.",
"type": "UnauthorizedAccess:EC2/SSHBruteForce",
"updatedAt": "2023-02-16T16:01:36.608Z"
},
"status": "open",
"title": "35.180.1.1 is performing SSH brute force attacks against i-44444444444444444.",
"type": "guard_duty_host",
"updatedOn": "2023-02-16T16:01:36Z"
}
}
}
Human Readable Output
Showing 1 of 1 results:
Host Finding Details
Account Id Region Id Finding Id Type Source Severity Status Created On Updated On Normalized Names Scan Id Resource Cloud Id Source Data Account ID ARN Title Description Resource Url 555555555555 us-east-1 66666666666666666666666666666666 guard_duty_host guardduty low open 2023-01-03T16:13:25Z 2023-02-16T16:01:36Z UnauthorizedAccess:EC2/SSHBruteForce scan-id-5 i-44444444444444444 555555555555 arn:aws:trail:us-west-1:888888888888:trail/control 35.180.1.1 is performing SSH brute force attacks against i-44444444444444444. 35.180.1.1 is performing SSH brute force attacks against i-44444444444444444. Brute force attacks are used to gain unauthorized access to your instance by guessing the SSH password. https://some_url?#/findings?search=id%3D66666666666666666666666666666666
prisma-cloud-permission-list
Get permission list. You must provide either “query” or “next_token”.
Base Command
prisma-cloud-permission-list
Input
| Argument Name | Description | Required |
|---|---|---|
| user_id | User ID to look for. Must be provided with the “query” argument. | Optional |
| query | IAM query to run in Prisma Cloud config API using RQL language. For more information see: https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-rql-reference/rql-reference/iam-query. | Optional |
| limit | Maximum number of entries to return. Default is 50. | Optional |
| next_token | Token of the next page to retrive. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.PermissionPageToken.nextPageToken | String | Next page token. |
| PrismaCloud.Permission.id | String | Permission ID. |
| PrismaCloud.Permission.sourceCloudType | String | Permission source cloud type. |
| PrismaCloud.Permission.sourceCloudAccount | String | Permission source cloud account. |
| PrismaCloud.Permission.sourceResourceId | String | Permission source resource ID. |
| PrismaCloud.Permission.destCloudType | String | Permission destination cloud type. |
| PrismaCloud.Permission.destCloudServiceName | String | Permission destination cloud service name. |
| PrismaCloud.Permission.destResourceType | String | Permission destination resource type. |
| PrismaCloud.Permission.effectiveActionName | String | Permission effective action name. |
| PrismaCloud.Permission.grantedByCloudType | String | Permission granted by cloud type. |
| PrismaCloud.Permission.grantedByCloudPolicyId | String | Permission granted by cloud policy ID. |
| PrismaCloud.Permission.grantedByCloudPolicyName | String | Permission granted by cloud policy name. |
| PrismaCloud.Permission.grantedByCloudPolicyType | String | Permission granted by cloud policy type. |
| PrismaCloud.Permission.grantedByCloudPolicyRrn | String | Permission granted by cloud policy restricted resource name. |
| PrismaCloud.Permission.grantedByCloudEntityId | String | Permission granted by cloud entity ID. |
| PrismaCloud.Permission.grantedByCloudEntityName | String | Permission granted by cloud entity name. |
| PrismaCloud.Permission.grantedByCloudEntityRrn | String | Permission granted by cloud entity restricted resource name. |
| PrismaCloud.Permission.sourcePublic | Boolean | Whether the permission source is public. |
| PrismaCloud.Permission.sourceCloudRegion | String | Permission source cloud region. |
| PrismaCloud.Permission.sourceCloudServiceName | String | Permission source cloud service name. |
| PrismaCloud.Permission.sourceResourceName | String | Permission source resource name. |
| PrismaCloud.Permission.sourceResourceType | String | Permission source resource type. |
| PrismaCloud.Permission.sourceIdpService | String | Permission source IDP service. |
| PrismaCloud.Permission.sourceIdpDomain | String | Permission source IDP domain. |
| PrismaCloud.Permission.sourceIdpEmail | String | Permission source IDP email. |
| PrismaCloud.Permission.sourceIdpUsername | String | Permission source IDP username. |
| PrismaCloud.Permission.sourceIdpGroup | String | Permission source IDP group. |
| PrismaCloud.Permission.sourceIdpRrn | String | Permission source IDP restricted resource name. |
| PrismaCloud.Permission.sourceCloudResourceRrn | String | Permission source cloud resource restricted resource name. |
| PrismaCloud.Permission.destCloudAccount | String | Permission destination cloud account. |
| PrismaCloud.Permission.destCloudRegion | String | Permission destination cloud region. |
| PrismaCloud.Permission.destResourceName | String | Permission destination resource name. |
| PrismaCloud.Permission.destResourceId | String | Permission destination resource ID. |
| PrismaCloud.Permission.destCloudResourceRrn | String | Permission destination cloud resource restricted resource name. |
| PrismaCloud.Permission.grantedByCloudEntityType | String | Permission granted by cloud entity type. |
| PrismaCloud.Permission.accessedResourcesCount | String | Permission accessed resources count. |
| PrismaCloud.Permission.lastAccessDate | String | Permission last access date. |
| PrismaCloud.Permission.lastAccessStatus | String | Permission last access status. |
| PrismaCloud.Permission.isWildCardDestCloudResourceName | Boolean | Whether the destination cloud resource name is a wildcard. |
| PrismaCloud.Permission.exceptions | Unknown | Permission exceptions. |
| PrismaCloud.Permission.grantedByLevelType | String | Permission granted by level type. |
| PrismaCloud.Permission.grantedByLevelId | String | Permission granted by level ID. |
| PrismaCloud.Permission.grantedByLevelName | String | Permission granted by level name. |
| PrismaCloud.Permission.grantedByLevelRrn | String | Permission granted by level restricted resource name. |
Command example
!prisma-cloud-permission-list query="config from iam where source.cloud.service.name = 'EC2'" limit=2
Context Example
{
"PrismaCloud": {
"Permission": [
{
"accessedResourcesCount": null,
"destCloudAccount": "AWS-JLo",
"destCloudRegion": "*",
"destCloudResourceRrn": null,
"destCloudServiceName": "ec2",
"destCloudType": "AWS",
"destResourceId": "*",
"destResourceName": "*",
"destResourceType": "instance",
"effectiveActionName": "ssm:UpdateInstanceInformation",
"exceptions": [
{
"messageCode": "CLOUD_EVENT_NOT_SUPPORTED"
},
{
"messageCode": "AWS_ROOT_ACCOUNT_IS_NOT_ONBOARDED"
}
],
"grantedByCloudEntityId": "arn:aws:trail:us-west-1:888888888888:trail/control",
"grantedByCloudEntityName": "service-role/AWSCloud9SSMAccessRole",
"grantedByCloudEntityRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"grantedByCloudEntityType": "role",
"grantedByCloudPolicyId": "arn:aws:arn:aws:trail:us-west-1:888888888888:trail/control",
"grantedByCloudPolicyName": "AWSCloud9SSMInstanceProfile",
"grantedByCloudPolicyRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"grantedByCloudPolicyType": "AWS Managed Policy",
"grantedByCloudType": "AWS",
"grantedByLevelId": null,
"grantedByLevelName": null,
"grantedByLevelRrn": null,
"grantedByLevelType": "",
"id": "jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj",
"isWildCardDestCloudResourceName": true,
"lastAccessDate": null,
"lastAccessStatus": "NOT_AVAILABLE",
"sourceCloudAccount": "AWS-JLo",
"sourceCloudRegion": "AWS Oregon",
"sourceCloudResourceRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"sourceCloudServiceName": "ec2",
"sourceCloudType": "AWS",
"sourceIdpDomain": null,
"sourceIdpEmail": null,
"sourceIdpGroup": null,
"sourceIdpRrn": null,
"sourceIdpService": null,
"sourceIdpUsername": null,
"sourcePublic": false,
"sourceResourceId": "arn:aws:trail:us-west-1:888888888888:trail/control",
"sourceResourceName": "i-33333333333333333",
"sourceResourceType": "instance"
},
{
"accessedResourcesCount": null,
"destCloudAccount": "AWS-JLo",
"destCloudRegion": "*",
"destCloudResourceRrn": null,
"destCloudServiceName": "ssm",
"destCloudType": "AWS",
"destResourceId": "*",
"destResourceName": "*",
"destResourceType": "managed-instance",
"effectiveActionName": "ssm:UpdateInstanceInformation",
"exceptions": [
{
"messageCode": "CLOUD_EVENT_NOT_SUPPORTED"
},
{
"messageCode": "AWS_ROOT_ACCOUNT_IS_NOT_ONBOARDED"
}
],
"grantedByCloudEntityId": "arn:aws:arn:aws:trail:us-west-1:888888888888:trail/control",
"grantedByCloudEntityName": "service-role/AWSCloud9SSMAccessRole",
"grantedByCloudEntityRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"grantedByCloudEntityType": "role",
"grantedByCloudPolicyId": "arn:aws:trail:us-west-1:888888888888:trail/control",
"grantedByCloudPolicyName": "AWSCloud9SSMInstanceProfile",
"grantedByCloudPolicyRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"grantedByCloudPolicyType": "AWS Managed Policy",
"grantedByCloudType": "AWS",
"grantedByLevelId": null,
"grantedByLevelName": null,
"grantedByLevelRrn": null,
"grantedByLevelType": "",
"id": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk",
"isWildCardDestCloudResourceName": true,
"lastAccessDate": null,
"lastAccessStatus": "NOT_AVAILABLE",
"sourceCloudAccount": "AWS-JLo",
"sourceCloudRegion": "AWS Oregon",
"sourceCloudResourceRrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25",
"sourceCloudServiceName": "ec2",
"sourceCloudType": "AWS",
"sourceIdpDomain": null,
"sourceIdpEmail": null,
"sourceIdpGroup": null,
"sourceIdpRrn": null,
"sourceIdpService": null,
"sourceIdpUsername": null,
"sourcePublic": false,
"sourceResourceId": "arn:aws:trail:us-west-1:888888888888:trail/control",
"sourceResourceName": "i-33333333333333333",
"sourceResourceType": "instance"
}
],
"PermissionPageToken": {
"nextPageToken": "token2"
}
}
}
Human Readable Output
Showing 2 of 20261 results:
Permissions Details
Id Source Cloud Type Source Cloud Account Source Resource Id Destination Cloud Type Destination Cloud Service Name Destination Resource Type Effective Action Name Granted By Cloud Type Granted By Cloud Policy Id Granted By Cloud Policy Name Granted By Cloud Policy Type Granted By Cloud Policy Rrn Granted By Cloud Entity Id Granted By Cloud Entity Name Granted By Cloud Entity Rrn jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj AWS AWS-JLo arn:aws:trail:us-west-1:888888888888:trail/control AWS ec2 instance ssm:UpdateInstanceInformation AWS arn:aws:trail:us-west-1:888888888888:trail/control AWSCloud9SSMInstanceProfile AWS Managed Policy rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 arn:aws:iam::555555555555:role/service-role/AWSCloud9SSMAccessRole service-role/AWSCloud9SSMAccessRole rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk AWS AWS-JLo arn:aws:trail:us-west-1:888888888888:trail/control AWS ssm managed-instance ssm:UpdateInstanceInformation AWS arn:aws:trail:us-west-1:888888888888:trail/control AWSCloud9SSMInstanceProfile AWS Managed Policy rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 arn:aws:iam::555555555555:role/service-role/AWSCloud9SSMAccessRole service-role/AWSCloud9SSMAccessRole rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25 Next Page Token
token2
Access Keys
Access keys are a secure way to enable programmatic access to the Prisma Cloud API. By default, only the System Admin has API access and can enable API access for other administrators. If you have API access, you can create up to two access keys.
A service account is a special Prisma Cloud identity used to access Prisma Cloud programmatically via API.
To create a service account, see Add Service Accounts On Prisma Cloud
Base Command
prisma-cloud-access-key-create
Input
| Argument Name | Description | Required |
|---|---|---|
| name | Access key name. | Required |
| expires-on | Timestamp in milliseconds when access key expires. Default:0. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AccessKeys.id | String | Access key ID. |
| PrismaCloud.AccessKeys.secretKey | String | Access key secret. |
Command example
!prisma-cloud-access-key-create name=MyNewKey
Context Example
{
"PrismaCloud": {
"AccessKeys": [
{
"Id": "Id",
"Secret Key": "Secret Key"
}
]
}
}
prisma-cloud-access-keys-list
Input
| Argument Name | Description | Required |
|---|---|---|
| access-key | Returns the metadata of the access key that has the specified ID. | Optional |
| limit | Maximum number of entries to return. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AccessKeys.id | String | Access key ID. |
| PrismaCloud.AccessKeys.name | String | The name of the access key. |
| PrismaCloud.AccessKeys.createdBy | String | The user who created the access key. |
| PrismaCloud.AccessKeys.createdTs | String | Time access key was created. |
| PrismaCloud.AccessKeys.expiresOn | String | The time the access key expires. |
| PrismaCloud.AccessKeys.lastUsedTime | String | The last time the access key was used. |
| PrismaCloud.AccessKeys.status | String | Access key status. |
| PrismaCloud.AccessKeys.role.id | String | User role ID. |
| PrismaCloud.AccessKeys.role.name | String | User role name. |
| PrismaCloud.AccessKeys.roleType | String | User role permission type. |
| PrismaCloud.AccessKeys.username | String | Access key user name. |
Command example
!prisma-cloud-access-keys-list limit=2
Context Example
{
"PrismaCloud": {
"AccessKeys": [
{
"id": "string",
"name": "string",
"createdBy": "string",
"createdTs": "number",
"lastUsedTime": "number",
"status": "string",
"expiresOn": "number",
"role": {
"id": "string",
"name": "string"
},
"roleType": "string",
"username": "string"
},
{
"id": "string",
"name": "string",
"createdBy": "string",
"createdTs": "number",
"lastUsedTime": "number",
"status": "string",
"expiresOn": "number",
"role": {
"id": "string",
"name": "string"
},
"roleType": "string",
"username": "string"
}
]
}
}
prisma-cloud-access-key-disable
Input
| Argument Name | Description | Required |
|---|---|---|
| access-key | Access key ID. | Required |
Command example
!prisma-cloud-access-key-disable access-key=id
Human Readable Output
Access key mockmock-mock-mock-mock-mockmockmock was disabled successfully
prisma-cloud-access-key-enable
Input
| Argument Name | Description | Required |
|---|---|---|
| access-key | Access key ID. | Required |
Command example
!prisma-cloud-access-key-enable access-key=id
Human Readable Output
Access key mockmock-mock-mock-mock-mockmockmock was enabled successfully
prisma-cloud-access-key-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| access-key | Access key ID. | Required |
Command example
!prisma-cloud-access-key-delete access-key=id
Human Readable Output
Access key mockmock-mock-mock-mock-mockmockmock was successfully deleted successfully
Breaking changes from the previous version of this integration - Prisma Cloud v2
The following sections list the changes in this version.
Commands
The following commands were deprecated in this version because they are not supported by the API anymore
- redlock-list-scans
- redlock-get-scan-status**
- redlock-get-scan-results
The following commands were replaced in this version
- redlock-dismiss-alerts - this command is replaced by prisma-cloud-alert-dismiss.
- redlock-get-alert-details - this command is replaced by prisma-cloud-alert-get-details.
- redlock-get-remediation-details - this command is replaced by prisma-cloud-remediation-command-list.
- redlock-get-rql-response - this command is replaced by prisma-cloud-config-search.
- redlock-list-alert-filters - this command is replaced by prisma-cloud-alert-filter-list.
- redlock-reopen-alerts - this command is replaced by prisma-cloud-alert-reopen.
- redlock-search-alerts - this command is replaced by prisma-cloud-alert-search.
- redlock-search-config - this command is replaced by prisma-cloud-config-search.
- redlock-search-event - this command is replaced by prisma-cloud-event-search.
- redlock-search-network - this command is replaced by prisma-cloud-network-search.
Additional Considerations for this version
- “Risk detail” was removed from all commands because it is not supported by the API anymore.
- Commands from the previous version were kept in order to make to transition from v1 to v2 easy for existing playbooks. We encourage to use the new version of each command.
prisma-cloud-code-issues-list
Retrieves the code errors detected by Application Security during periodic scans.
Base Command
prisma-cloud-code-issues-list
Input
| Argument Name | Description | Required |
|---|---|---|
| git_users | Comma-separated list of names of Git users. | Optional |
| branch | A branch name. | Optional |
| code_categories | Comma-separated list of code issue categories. Is also available as a search criteria (search_scopes). Possible values are: IacMisconfiguration, IacExternalModule, ImageReferencerVul, ImageReferencerLicenses, Vulnerabilities, Licenses, Secrets. | Optional |
| iac_categories | Comma-separated list of categories related to Infrastructure-as-Code (IaC) issues. Possible values are: IAM, Monitoring, Networking, Kubernetes, General, Storage, Public, Drift, Compute. | Optional |
| iac_labels | Comma-separated list of labels associated with Infrastructure-as-Code (IaC). Possible values are: CustomPolicy, HasFix. | Optional |
| file_types | Comma-separated list of file types. Possible values are: yml, yaml, json, template, py, js, properties, pem, php, xml, ts, env, Dockerfile, java, rb, sum, mod, cs, txt, bicep, hcl, gradle, kts, lock, config, csproj, dependencies. | Optional |
| fixable_only | Whether to retrieve only fixable issues. Recommended to use this argument with another argument code_categories ,for example. Possible values are: true, false. | Optional |
| repositories | Comma-separated list of repository names. | Optional |
| secrets_risk_factors | Comma-separated list of risk factors related to secrets. Possible values are: PublicRepository, PrivateRepository, User, Privileged, Valid, Invalid, Unknown, FoundInHistory. | Optional |
| search_scopes | Comma-separated list of specific areas or categories within which to search. When specifying search_scopes, search_term argument is required. Possible values are: IacMisconfiguration, IacExternalModule, ImageReferencerVul, ImageReferencerLicenses, Vulnerabilities, Licenses, Secrets. |
Optional |
| severities | Comma-separated list of the criticality of issues. Possible values are: INFO, LOW, MEDIUM, HIGH, CRITICAL. | Optional |
| vulnerability_risk_factors | Comma-separated list of risk factors for vulnerabilities. Possible values are: AttackComplexity, AttackVector, DoS, HasFix, RemoteExecution, ExploitInTheWild, ExploitPOC, IsUsed. | Optional |
| search_term | A keyword or phrase used to narrow down results within specific scopes (like a particular vulnerability). It’s needed if you are filtering results by search_scopes. | Optional |
| iac_tags | An infrastructure-as-code (IaC) resource. Relevant only to- IacMisconfiguration,Vulnerabilities. | Optional |
| license_type | Comma-separated list of license types. | Optional |
| check_status | Status of checks. Possible values are: Error, Passed, Suppressed, FixPendin. | Optional |
| limit | The limit of issues to retrieve. Default is 50. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.CodeIssue.modifiedOn | String | The date and time when the code issue was last modified. |
| PrismaCloud.CodeIssue.isPublic | String | Indicates whether the repository or resource is publicly accessible (true/false). |
| PrismaCloud.CodeIssue.fileType | String | The type of file where the issue was detected (e.g., `.js`, `.py`). |
| PrismaCloud.CodeIssue.secretCommitRemove | String | The commit identifier where a secret was removed. |
| PrismaCloud.CodeIssue.secretCommitAdd | String | The commit identifier where a secret was added. |
| PrismaCloud.CodeIssue.gitUser | String | The username of the person who made the commit associated with the code issue. |
| PrismaCloud.CodeIssue.codePath | String | The path to the code file where the issue was detected. |
| PrismaCloud.CodeIssue.codeCategory | String | The category or classification of the detected issue (e.g., security, compliance). |
| PrismaCloud.CodeIssue.author | String | The original author of the code where the issue was detected. |
| PrismaCloud.CodeIssue.repositoryUuid | String | The unique identifier of the repository where the issue was found. |
| PrismaCloud.CodeIssue.path | String | The path in the repository where the issue was detected. |
| PrismaCloud.CodeIssue.repositorySource | String | The source of the repository (e.g., GitHub, Bitbucket). |
| PrismaCloud.CodeIssue.firstDetected | String | The date and time when the code issue was first detected. |
| PrismaCloud.CodeIssue.codeIssueLine | String | The line number in the code where the issue was detected. |
| PrismaCloud.CodeIssue.labels | String | Labels associated with the code issue for classification or categorization. |
| PrismaCloud.CodeIssue.labels.label | String | A specific label related to the code issue. |
| PrismaCloud.CodeIssue.labels.metadata.imageName | String | The name of the image associated with the label metadata. |
| PrismaCloud.CodeIssue.policy | String | The policy that was violated by the detected issue. |
| PrismaCloud.CodeIssue.repository | String | The name of the repository where the issue was found. |
| PrismaCloud.CodeIssue.resourceName | String | The name of the resource associated with the code issue. |
| PrismaCloud.CodeIssue.resourceScanType | String | The type of scan that detected the issue (e.g., static analysis, secret detection). |
| PrismaCloud.CodeIssue.resourceUuid | String | The unique identifier of the resource associated with the code issue. |
| PrismaCloud.CodeIssue.severity | String | The severity level of the detected issue (e.g., High, Medium, Low). |
| PrismaCloud.CodeIssue.violationId | String | The unique identifier for the policy violation related to the code issue. |
| PrismaCloud.CodeIssue.causePackageId | String | The ID of the package that caused the issue. |
| PrismaCloud.CodeIssue.causePackageName | String | The name of the package that caused the issue. |
| PrismaCloud.CodeIssue.cveUuid | String | The unique identifier of the Common Vulnerabilities and Exposures (CVE) related to the issue. |
| PrismaCloud.CodeIssue.cvss | String | The Common Vulnerability Scoring System (CVSS) score for the detected issue. |
| PrismaCloud.CodeIssue.fixVersion | String | The version of the code or package that contains the fix for the issue. |
| PrismaCloud.CodeIssue.pr | String | The pull request (PR) associated with resolving the code issue. |
| PrismaCloud.CodeIssue.resourceId | String | The identifier of the resource related to the code issue. |
| PrismaCloud.CodeIssue.riskFactors | String | Risk factors associated with the code issue, such as high-impact areas or sensitive data. |
| PrismaCloud.CodeIssue.isIndirectPackage | String | Indicates whether the issue is from an indirect package (true/false). |
prisma-cloud-asset-alerts-get
Returns detailed information for the asset alerts with the given ID.
Base Command
prisma-cloud-asset-alerts-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AssetAlerts.problem.title | String | The title of the problem. |
| PrismaCloud.AssetAlerts.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.AssetAlerts.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.AssetAlerts.problem.detail | String | The details of the problem. |
| PrismaCloud.AssetAlerts.problem.instance | String | The instance of the problem. |
| PrismaCloud.AssetAlerts.problem.type | String | The type of the problem. |
| PrismaCloud.AssetAlerts.problem.parameters | Unknown | The parameters of the problem. |
| PrismaCloud.AssetAlerts.id | String | The ID of the asset alert. |
| PrismaCloud.AssetAlerts.severity | String | The severity of the asset alert. |
| PrismaCloud.AssetAlerts.policyId | String | The policy ID of the asset alert. |
| PrismaCloud.AssetAlerts.isHyperionPolicy | Boolean | The hyperion policy of the asset alert. |
| PrismaCloud.AssetAlerts.policyType | String | The policy type of the asset alert. |
| PrismaCloud.AssetAlerts.policyName | String | The policy name of the asset alert. |
| PrismaCloud.AssetAlerts.policyDescription | String | The policy description of the asset alert. |
| PrismaCloud.AssetAlerts.alertTime | Number | The alert time of the asset alert. |
prisma-cloud-asset-network-get
Returns detailed information for the asset network with the given ID.
Base Command
prisma-cloud-asset-network-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AssetNetwork.problem.title | String | The title of the problem. |
| PrismaCloud.AssetNetwork.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.AssetNetwork.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.AssetNetwork.problem.detail | String | The details of the problem. |
| PrismaCloud.AssetNetwork.problem.instance | String | The instance of the problem. |
| PrismaCloud.AssetNetwork.problem.type | String | The type of the problem. |
| PrismaCloud.AssetNetwork.problem.parameters | Unknown | The parameters of the problem. |
| PrismaCloud.AssetNetwork.id | Number | The ID of the asset network. |
| PrismaCloud.AssetNetwork.access | String | The access of the asset network. |
| PrismaCloud.AssetNetwork.direction | String | The direction of the asset network. |
| PrismaCloud.AssetNetwork.ips | String | The IPS of the asset network. |
| PrismaCloud.AssetNetwork.ports | String | The ports of the asset network. |
| PrismaCloud.AssetNetwork.protocol | String | The protocol of the asset network. |
| PrismaCloud.AssetNetwork.priority | Number | The priority of the asset network. |
prisma-cloud-asset-vulnerabilities-get
Returns detailed information for the asset vulnerabilities with the given ID.
Base Command
prisma-cloud-asset-vulnerabilities-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AssetVulnerabilities.problem.title | String | The title of the problem. |
| PrismaCloud.AssetVulnerabilities.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.AssetVulnerabilities.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.AssetVulnerabilities.problem.detail | String | The details of the problem. |
| PrismaCloud.AssetVulnerabilities.problem.instance | String | The instance of the problem. |
| PrismaCloud.AssetVulnerabilities.problem.type | String | The type of the problem. |
| PrismaCloud.AssetVulnerabilities.problem.parameters | Unknown | The parameters of the problem. |
| PrismaCloud.AssetVulnerabilities.accountId | String | The account ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.count | String | The count of asset vulnerabilities. |
| PrismaCloud.AssetVulnerabilities.createdOn | Number | The created on of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.customerId | Number | The customer ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.cveId | String | The CVE ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.description | String | The description of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.externalId | Number | The external ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.id | String | The ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.normalizedName | String | The normalized name of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.normalizedNames | String | The normalized names of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.nvdUrl | String | The nvd URL of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.link | String | The link of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.rawData | String | The raw data of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.regionId | String | The region ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.resourceCloudId | String | The resource cloud ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.resourceId | Number | The resource ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.resourceUrl | String | The resource URL of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.riskFactors | String | The risk factors of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.rlUpdatedOn | Number | The rl updated on of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.scanId | String | The scan ID of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.score | String | The score of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.severity | String | The severity of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.source | String | The source of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.sourceData | Unknown | The source data of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.status | String | The status of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.title | String | The title of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.type | String | The type of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.packageName | String | The package name of the asset vulnerability. |
| PrismaCloud.AssetVulnerabilities.updatedOn | Number | The updated on of the asset vulnerability. |
prisma-cloud-asset-get
Returns detailed information for the asset with the given ID.
Base Command
prisma-cloud-asset-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified Asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, Package ID, or Layer ID. The value needs to be fetched from one of the groups by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.Asset.problem.title | String | The title of the problem. |
| PrismaCloud.Asset.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.Asset.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.Asset.problem.detail | String | The details of the problem. |
| PrismaCloud.Asset.problem.instance | String | The instance of the problem. |
| PrismaCloud.Asset.problem.type | String | The type of the problem. |
| PrismaCloud.Asset.problem.parameters | Unknown | The parameters of the problem. |
| PrismaCloud.Asset.id | String | The ID of the asset. |
| PrismaCloud.Asset.prismaId | String | The Prisma ID of the asset. |
| PrismaCloud.Asset.appName | String | The app name of the asset. |
| PrismaCloud.Asset.externalAssetId | String | The external asset ID of the asset. |
| PrismaCloud.Asset.assetTypeId | Number | The asset type ID of the asset. |
| PrismaCloud.Asset.cloudType | String | The cloud type of the asset. |
| PrismaCloud.Asset.createdTs | Number | The creation timestamp of the asset. |
| PrismaCloud.Asset.insertTs | Number | The insertion timestamp of the asset. |
| PrismaCloud.Asset.data | Unknown | The data of the asset. |
| PrismaCloud.Asset.dynamicData | Unknown | The dynamic data of the asset. |
| PrismaCloud.Asset.riskGrade | String | The risk grade of the asset. |
| PrismaCloud.Asset.stateId | String | The state ID of the asset. |
| PrismaCloud.Asset.name | String | The name of the asset. |
| PrismaCloud.Asset.regionId | String | The region ID of the asset. |
| PrismaCloud.Asset.regionName | String | The region name of the asset. |
| PrismaCloud.Asset.altAssetId | String | The alternative asset ID of the asset. |
| PrismaCloud.Asset.url | String | The URL of the asset. |
| PrismaCloud.Asset.vpcId | String | The VPC ID of the asset. |
| PrismaCloud.Asset.vpcExternalAssetId | String | The VPC external asset ID of the asset. |
| PrismaCloud.Asset.vpcName | String | The VPC name of the asset. |
| PrismaCloud.Asset.tags | Unknown | The tags of the asset. |
| PrismaCloud.Asset.relationshipCounts | Number | The relationship counts of the asset. |
| PrismaCloud.Asset.vulnerabilityCounts | Unknown | The vulnerability counts of the asset. |
| PrismaCloud.Asset.accountName | String | The account name of the asset. |
| PrismaCloud.Asset.assetType | String | The account type of the asset. |
| PrismaCloud.Asset.serviceName | String | The service name of the asset. |
| PrismaCloud.Asset.resourceType | String | The resource type of the asset. |
| PrismaCloud.Asset.deleted | Boolean | The deletion state of the asset. |
| PrismaCloud.Asset.assetClassId | String | The asset class ID of the asset. |
| PrismaCloud.Asset.assetClass | String | The asset class of the asset. |
| PrismaCloud.Asset.attributes | Unknown | The attributes of the asset. |
| PrismaCloud.Asset.alertsCount.severity | String | The severity of the alerts of the asset. |
| PrismaCloud.Asset.alertsCount.count | Number | The alert count of the asset. |
| PrismaCloud.Asset.ipAddresses | String | The IP addresses of the asset. |
| PrismaCloud.Asset.trueInternetExposure | String | The internet exposure state of the asset. |
| PrismaCloud.Asset.dataSecurity | Unknown | The data security of the asset. |
prisma-cloud-asset-generic-get
Returns detailed information for the asset with the given ID.
Base Command
prisma-cloud-asset-generic-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| type | Asset domain service query type. Possible values are: external_finding, asset, asset_lite, alerts, alerts_counts, alert_summary, finding_summary, attack_path, attack_path_summary, raw_config, network, timeline, external_integration, asset_data_indicators, relationships, findings, vulnerabilities, permissions, package_info, labels, vulnerability_aggregates, process_info, vulnerabilities_group_by_type, asset_cwp_vulns, app_contexts, attributes, data_security, data_security_summary. Default is asset. | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
There is no context output for this command.
prisma-cloud-asset-findings-get
Returns detailed information for the asset findings with the given ID.
Base Command
prisma-cloud-asset-findings-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AssetFindings.problem.title | String | The title of the problem. |
| PrismaCloud.AssetFindings.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.AssetFindings.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.AssetFindings.problem.detail | String | The details of the problem. |
| PrismaCloud.AssetFindings.problem.instance | String | The instance of the problem. |
| PrismaCloud.AssetFindings.problem.type | String | The type of the problem. |
| PrismaCloud.AssetFindings.problem.parameters | Unknown | The parameters of the problem. |
| PrismaCloud.AssetFindings.accountId | String | The account ID of the asset findings. |
| PrismaCloud.AssetFindings.count | String | The count of asset findings. |
| PrismaCloud.AssetFindings.createdOn | Number | The created on of the asset findings. |
| PrismaCloud.AssetFindings.customerId | Number | The customer ID of the asset findings. |
| PrismaCloud.AssetFindings.cveId | String | The CVE ID of the asset findings. |
| PrismaCloud.AssetFindings.description | String | The description of the asset findings. |
| PrismaCloud.AssetFindings.externalId | Number | The external ID of the asset findings. |
| PrismaCloud.AssetFindings.id | String | The ID of the asset findings. |
| PrismaCloud.AssetFindings.normalizedName | String | The normalized name of the asset findings. |
| PrismaCloud.AssetFindings.normalizedNames | String | The normalized names of the asset findings. |
| PrismaCloud.AssetFindings.nvdUrl | String | The nvd URL of the asset findings. |
| PrismaCloud.AssetFindings.link | String | The link of the asset findings. |
| PrismaCloud.AssetFindings.rawData | String | The raw data of the asset findings. |
| PrismaCloud.AssetFindings.regionId | String | The region ID of the asset findings. |
| PrismaCloud.AssetFindings.resourceCloudId | String | The resource cloud ID of the asset findings. |
| PrismaCloud.AssetFindings.resourceId | Number | The resource ID of the asset findings. |
| PrismaCloud.AssetFindings.resourceUrl | String | The resource URL of the asset findings. |
| PrismaCloud.AssetFindings.riskFactors | String | The risk factors of the asset findings. |
| PrismaCloud.AssetFindings.rlUpdatedOn | Number | The rl updated on of the asset findings. |
| PrismaCloud.AssetFindings.scanId | String | The scan ID of the asset findings. |
| PrismaCloud.AssetFindings.score | String | The score of the asset findings. |
| PrismaCloud.AssetFindings.severity | String | The severity of the asset findings. |
| PrismaCloud.AssetFindings.source | String | The source of the asset findings. |
| PrismaCloud.AssetFindings.sourceData | Unknown | The source data of the asset findings. |
| PrismaCloud.AssetFindings.status | String | The status of the asset findings. |
| PrismaCloud.AssetFindings.title | String | The title of the asset findings. |
| PrismaCloud.AssetFindings.type | String | The type of the asset findings. |
| PrismaCloud.AssetFindings.packageName | String | The package name of the asset findings. |
| PrismaCloud.AssetFindings.updatedOn | Number | The updated on of the asset findings. |
prisma-cloud-asset-relationships-get
Returns detailed information for the asset relationships with the given ID.
Base Command
prisma-cloud-asset-relationships-get
Input
| Argument Name | Description | Required |
|---|---|---|
| asset_id | Unified asset ID or RRN (Restricted Resource Name). | Required |
| finding_type | External finding types. Possible values are: COMPLIANCE_CIS, GUARD_DUTY_HOST, GUARD_DUTY_IAM, INSPECTOR_RBA, INSPECTOR_SBP, NETWORK_REACHABILITY, AZURE_SECURITY_CENTER_ALERTS, UNCLASSIFIED, COMMAND_AND_CONTROL, CREDENTIAL_ACCESS, CROSS_ACCOUNT_TRUST, DATA_EXFILTRATION, DEFENSE_EVASION, DISCOVERY, HIGH_PRIVILEGED_ROLE, INITIAL_ACCESS, INTERNET_EXPOSURE, KEYS_AND_SECRETS, LATERAL_MOVEMENT, MALWARE, MFA, MISCONFIGURATION, NETWORK_ANOMALY, PRIVILEGE_ESCALATION, RECONNAISSANCE, RESOURCE_HIJACKING, SSH_BRUTE_FORCE, UNAUTHORIZED_ACCESS, UNENCRYPTED_DATA, UNUSED_PRIVILEGES, USER_ANOMALY, WEAK_PASSWORD, SENSITIVE_DATA_EXPOSURE, INJECTIONS, VULNERABILITY_SCANNING, SHELLSHOCK, KNOWN_BOTS, UNKNOWN_BOTS, VIRTUAL_PATCHES, WEB_ATTACK, BOT_ACTIVITY, WEB_SCRAPING, CUSTOM, VULNERABILITY, HOST_VULNERABILITY_CVE, CONTAINER_IMAGE_VULNERABILITY_CVE, VIRTUAL_IMAGE_VULNERABILITY_CVE, SERVERLESS_VULNERABILITY, PACKAGE_VULNERABILITY. | Optional |
| risk_factors | Comma-separated list of external finding risk factors. Possible values are: CRITICAL_SEVERITY, HIGH_SEVERITY, MEDIUM_SEVERITY, HAS_FIX, REMOTE_EXECUTION, DOS, RECENT_VULNERABILITY, EXPLOIT_EXISTS, ATTACK_COMPLEXITY_LOW, ATTACK_VECTOR_NETWORK, REACHABLE_FROM_THE_INTERNET, LISTENING_PORTS, CONTAINER_IS_RUNNING_AS_ROOT, NO_MANDATORY_SECURITY_PROFILE_APPLIED, RUNNING_AS_PRIVILEGED_CONTAINER, PACKAGE_IN_USE, DOS_LOW, DOS_HIGH, EXPLOIT_EXISTS_IN_THE_WILD, EXPLOIT_EXISTS_POC, SENSITIVE_INFORMATION, ROOT_MOUNT, RUNTIME_SOCKET, HOST_ACCESS. | Optional |
| timeline_item_id | Timeline item ID. | Optional |
| alert_ids | Comma-separated list of alert IDs. | Optional |
| limit | Limit number of records. | Optional |
| permission_type | Permissions type. | Optional |
| page_token | Next page token. | Optional |
| prisma_cloud_findings_only | Filter Hyperion findings. Possible values are: true, false. | Optional |
| vulnerability_info_type_id | CVE ID, package ID, or layer ID. The value needs to be fetched from one of the group by API calls. | Optional |
| vulnerability_info_type | Supported vulnerability types. Possible values are: CVE, PACKAGE, LAYER. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| PrismaCloud.AssetRelationships.assetId | String | The asset ID of the asset relationship. |
| PrismaCloud.AssetRelationships.relationshipType | String | The relationship type of the asset relationship. |
| PrismaCloud.AssetRelationships.assetTypeId | Number | The asset type ID of the asset relationship. |
| PrismaCloud.AssetRelationships.assetType | String | The asset type of the asset relationship. |
| PrismaCloud.AssetRelationships.assetName | String | The asset name of the asset relationship. |
| PrismaCloud.AssetRelationships.externalAssetId | String | The external asset ID of the asset relationship. |
| PrismaCloud.AssetRelationships.cloudId | String | The cloud ID of the asset relationship. |
| PrismaCloud.AssetRelationships.cloudName | String | The cloud name of the asset relationship. |
| PrismaCloud.AssetRelationships.pseudoAsset | Boolean | The pseudo asset of the asset relationship. |
| PrismaCloud.AssetRelationships.region | String | The region of the asset relationship. |
| PrismaCloud.AssetRelationships.cloudAccountId | String | The cloud account ID of the asset relationship. |
| PrismaCloud.AssetRelationships.assetClassId | String | The asset class ID of the asset relationship. |
| PrismaCloud.AssetRelationships.assetClass | String | The asset class of the asset relationship. |
| PrismaCloud.AssetRelationships.alertsCount.severity | String | The severity of the alerts of the asset relationship. |
| PrismaCloud.AssetRelationships.alertsCount.count | Number | The number of alerts of the asset relationships. |
| PrismaCloud.AssetRelationships.alertCountBySeverity.severity | String | The severity of the alerts of the asset relationship. |
| PrismaCloud.AssetRelationships.alertCountBySeverity.count | Number | The number of alerts by severity of the asset relationship. |
| PrismaCloud.AssetRelationships.vulnerabilityCounts | Unknown | The number of vulnerabilities of the asset relationship. |
| PrismaCloud.AssetRelationships.problem.title | String | The title of the problem. |
| PrismaCloud.AssetRelationships.problem.status.statusCode | Number | The status code of the problem. |
| PrismaCloud.AssetRelationships.problem.status.reasonPhrase | String | The reason for the problem. |
| PrismaCloud.AssetRelationships.problem.detail | String | The details of the problem. |
| PrismaCloud.AssetRelationships.problem.instance | String | The instance of the problem. |
| PrismaCloud.AssetRelationships.problem.type | String | The type of the problem. |
| PrismaCloud.AssetRelationships.problem.parameters | Unknown | The parameters of the problem. |
Configuration parameters
url— Server URL (required)credentials— Username / Access Key ID (required)proxy— Use system proxy settingsinsecure— Trust any certificate (not secure)incidentType— Incident typeincidentFetchInterval— Incidents Fetch Intervalmax_fetch— Maximum number of incidents to fetchfirst_fetch— First fetch time intervallook_back— Advanced: Time in minutes to look back when fetching incidentsfilters— Fetch only incidents matching these filtersisFetch— Fetch incidentsmirror_direction— Incident Mirroring Directionclose_incident— Close Mirrored XSOAR Incidentclose_alert— Close Mirrored Prisma Cloud Alertoutput_old_format— Output results of V1 commands to the context data in the old format
Commands (47)
-
get-modified-remote-dataGet the list of incidents that were modified since the last update time. This method is used for debugging purposes. The get-modified-remote-data command is used as part of the Mirroring feature that was introduced in Cortex XSOAR version 6.1.
-
get-remote-dataGet remote data from a remote incident. This method does not update the current incident, and should be used for debugging purposes only.
-
prisma-cloud-access-key-createAdds a new access key for the current user. If you have API access, you can create up to two access keys.
-
prisma-cloud-access-key-deleteDeletes the access key that has the specified ID.
-
prisma-cloud-access-key-disableDeactivates the access key that has the specified ID.
-
prisma-cloud-access-key-enableActivates the access key that has the specified ID. You cannot activate an expired access key.
-
prisma-cloud-access-keys-listReturns all access keys for your tenant if you have a Prisma Cloud System Admin role. Returns just your access keys if you don't have this role.
-
prisma-cloud-account-listList accounts.
-
prisma-cloud-account-owner-listGet the owners of the provided accounts.
-
prisma-cloud-account-status-getGet the statuses of the provided accounts.
-
prisma-cloud-alert-dismissDismiss or snooze the alerts matching the given filter. Either policy IDs or alert IDs must be provided. When no absolute time nor relative time arguments are provided, the default time range is all times. For snoozing, provide "snooze_unit" and "snooze_value" arguments.
-
prisma-cloud-alert-filter-listList the acceptable filters and values for alerts.
-
prisma-cloud-alert-get-detailsGets the details of an alert based on the alert ID.
-
prisma-cloud-alert-remediateRemediates the alert with the specified ID, if that alert is associated with a remediable policy. In order to check what remediation would run, use the "prisma-cloud-remediation-command-list" command first.
-
prisma-cloud-alert-reopenRe-open the alerts matching the given filter. Either policy IDs or alert IDs must be provided. When no absolute time nor relative time arguments are provided, the default time range is all times.
-
prisma-cloud-alert-searchSearch alerts on the Prisma Cloud platform. When no absolute time nor relative time arguments are provided, the search will show alerts from the last 7 days.
-
prisma-cloud-asset-alerts-getReturns detailed information for the asset alerts with the given ID.
-
prisma-cloud-asset-findings-getReturns detailed information for the asset findings with the given ID.
-
prisma-cloud-asset-generic-getReturns detailed information for the asset with the given ID.
-
prisma-cloud-asset-getReturns detailed information for the asset with the given ID.
-
prisma-cloud-asset-network-getReturns detailed information for the asset network with the given ID.
-
prisma-cloud-asset-relationships-getReturns detailed information for the asset relationships with the given ID.
-
prisma-cloud-asset-vulnerabilities-getReturns detailed information for the asset vulnerabilities with the given ID.
-
prisma-cloud-code-issues-listRetrieves the code errors detected by Application Security during periodic scans. At least one filtering argument is required, excluding `search_scopes`, `search_term`, and `limit`. For example, `fixable_only` or 'branch`.
-
prisma-cloud-config-searchSearch configuration inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with "config". When no absolute time nor relative time arguments are provided, the default time range is all times.
-
prisma-cloud-error-file-listDeprecatedThis command is deprecated. Use prisma-cloud-code-issues-list instead.
-
prisma-cloud-event-searchSearch events inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with "event". When no absolute time nor relative time arguments are provided, the default time range is all times. In order to reduce the returned data, set the "include_resource_json" argument to "false".
-
prisma-cloud-host-finding-listGet resource host finding list.
-
prisma-cloud-network-searchSearch networks inventory on the Prisma Cloud platform using RQL language. Use this command for all queries that start with "networks". When no absolute time nor relative time arguments are provided, the default time range is all times. In order to limit the results returning, use "limit search records to" at the end of the RQL query, followed by a value from one of these options: 1, 10, 100, 1000, and 10,000.
-
prisma-cloud-permission-listGet permission list. You must provide either "query" or "next_token".
-
prisma-cloud-remediation-command-listGenerates and returns a list of remediation commands for the specified alerts and policies. Data returned for a successful call include fully constructed commands for remediation. Either a policy ID or alert IDs must be provided. The returned information can be retrieved in the UI by clicking the "Remediate" button under the "Actions" column for supported alerts. When no absolute time nor relative time arguments are provided, the default time range is all times.
-
prisma-cloud-resource-getGet resource details.
-
prisma-cloud-resource-listReturns all the resource lists. Maps to the Resource Lists under Settings > Resource Lists in the Console UI.
-
prisma-cloud-trigger-scanTrigger asynchronous scan of all resources to refresh the current state at Prisma Cloud Code Security. In order to use this command, the "Code Security" module needs to be enabled and accessible in the Prisma Cloud UI.
-
prisma-cloud-user-roles-listRetrieves user roles. Maps to Settings > Access Control > Roles in the Console UI.
-
prisma-cloud-users-listLists all users and service accounts for your tenant. Maps to Settings > Access Control > Users in the Console UI.
-
redlock-dismiss-alertsDeprecatedDismiss the alerts matching the given filter. Must provide either policy IDs or alert IDs.
-
redlock-get-alert-detailsDeprecatedGets the details of an alert based on the alert ID.
-
redlock-get-remediation-detailsDeprecatedGets remediation details for the given alert.
-
redlock-get-rql-responseDeprecatedReturns the results of an RQL config query.
-
redlock-list-alert-filtersDeprecatedList the acceptable filters and values for alerts.
-
redlock-reopen-alertsDeprecatedRe-open the alerts matching the given filter. Must provide either policy IDs or alert IDs.
-
redlock-search-alertsDeprecatedSearch alerts on the Prisma Cloud platform. If no time-range arguments are given, the search will filter only alerts from the last 7 days.
-
redlock-search-configDeprecatedSearch the configuration inventory on the Prisma Cloud platform using RQL language.
-
redlock-search-eventDeprecatedSearch events on the Prisma Cloud platform using RQL language.
-
redlock-search-networkDeprecatedSearch networks on the Prisma Cloud platform using RQL language.
-
update-remote-systemUpdates the remote incident with local incident changes. This method is only used for debugging purposes and will not update the current incident.
from unittest.mock import patch import pytest from CommonServerPython import * # noqa: F401 from freezegun import freeze_time from PrismaCloudV2 import Client from test_data import input_data AUTH_HEADER = "auth_header" @pytest.fixture @patch("PrismaCloudV2.Client.generate_auth_token") def prisma_cloud_v2_client(mocker): from PrismaCloudV2 import HEADERS, REQUEST_CSPM_AUTH_HEADER headers = HEADERS headers[REQUEST_CSPM_AUTH_HEADER] = AUTH_HEADER return Client( server_url="https://api.prismacloud.io/", verify=True, proxy=False, headers=headers, username="username", password="password", mirror_direction=None, close_incident=False, close_alert=False, is_test_module=False, ) """ COMMAND FUNCTIONS TESTS """ def test_alert_filter_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-alert-filter-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_filter_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") alert_filter_list_command(prisma_cloud_v2_client) http_request.assert_called_with("GET", "filter/alert/suggest") def test_alert_search_command_no_next_token(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed without "next_token" When: - prisma-cloud-alert-search command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_search_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = { "filters": "alert.status=open,policy.remediable=true,cloud.type=gcp,policy.type=config", "limit": "10", "time_range_unit": "week", "time_range_value": "3", } alert_search_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "v2/alert", params={"detailed": "true"}, json_data={ "limit": 10, "filters": [ {"name": "alert.status", "operator": "=", "value": "open"}, {"name": "policy.remediable", "operator": "=", "value": "true"}, {"name": "cloud.type", "operator": "=", "value": "gcp"}, {"name": "policy.type", "operator": "=", "value": "config"}, ], "timeRange": {"type": "relative", "value": {"amount": 3, "unit": "week"}}, }, retries=2, ) def test_alert_search_command_with_next_token(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed with "next_token" When: - prisma-cloud-alert-search command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_search_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"limit": "10", "time_range_unit": "week", "time_range_value": "3", "next_token": "TOKEN"} alert_search_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "v2/alert", params={"detailed": "true"}, json_data={"limit": 10, "timeRange": {"type": "relative", "value": {"amount": 3, "unit": "week"}}, "pageToken": "TOKEN"}, retries=2, ) def test_alert_get_details_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-alert-get-details command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_get_details_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"alert_id": "P-123456"} alert_get_details_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "alert/P-123456", params={"detailed": "true"}) def test_alert_dismiss_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed when dismissing alert When: - prisma-cloud-alert-dismiss command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_dismiss_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = { "alert_ids": "P-123456", "policy_ids": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5", "dismissal_note": "from XSOAR", "time_range_unit": "month", } alert_dismiss_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "alert/dismiss", json_data={ "alerts": ["P-123456"], "policies": ["a11b2cc3-1111-2222-33aa-a1b23ccc4dd5"], "dismissalNote": "from XSOAR", "filter": {"timeRange": {"type": "to_now", "value": "month"}}, }, resp_type="response", ) def test_alert_snooze_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed when snoozing alert When: - prisma-cloud-alert-dismiss command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_dismiss_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"alert_ids": "P-123456,P-111111", "dismissal_note": "from XSOAR", "snooze_unit": "hour", "snooze_value": "1"} alert_dismiss_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "alert/dismiss", json_data={ "alerts": ["P-123456", "P-111111"], "dismissalNote": "from XSOAR", "dismissalTimeRange": {"type": "relative", "value": {"amount": 1, "unit": "hour"}}, "filter": {"timeRange": {"type": "relative", "value": {"amount": 1, "unit": "hour"}}}, }, resp_type="response", ) def test_alert_reopen_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-alert-reopen command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import alert_reopen_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = { "policy_ids": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5", "filters": "alert.status=dismissed", "time_range_date_from": "01/31/2023", "time_range_date_to": "02/01/2023", } alert_reopen_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "alert/reopen", json_data={ "policies": ["a11b2cc3-1111-2222-33aa-a1b23ccc4dd5"], "dismissalTimeRange": {"type": "absolute", "value": {"startTime": 1675123200000, "endTime": 1675209600000}}, "filter": { "timeRange": {"type": "absolute", "value": {"startTime": 1675123200000, "endTime": 1675209600000}}, "filters": [{"name": "alert.status", "operator": "=", "value": "dismissed"}], }, }, resp_type="response", ) def test_remediation_command_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-remediation-command-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import remediation_command_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"policy_id": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5"} remediation_command_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "alert/remediation", json_data={ "filter": {"timeRange": {"type": "to_now", "value": "epoch"}}, "policies": ["a11b2cc3-1111-2222-33aa-a1b23ccc4dd5"], }, ) def test_alert_remediate_command_pass(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-alert-remediate command is executed with an alert id that can be remediated Then: - The http request is called with the right arguments and the right result is returned """ from PrismaCloudV2 import alert_remediate_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"alert_id": "P-123456"} command_results = alert_remediate_command(prisma_cloud_v2_client, args) http_request.assert_called_with("PATCH", "alert/remediation/P-123456", resp_type="response") assert command_results.outputs == {"alertId": "P-123456", "successful": True} def test_alert_remediate_command_fail(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-alert-remediate command is executed with an alert id that cannot be remediated Then: - The http request is called with the right arguments and the right result is returned """ from PrismaCloudV2 import alert_remediate_command class MockRes: def __init__(self, headers, status_code) -> None: self.headers = headers self.status_code = status_code error_header = '[{"i18nKey":"remediation_unavailable","severity":"error","subject":null}]' http_request = mocker.patch.object( prisma_cloud_v2_client, "_http_request", side_effect=DemistoException( message="Error in API call [405] - Method Not Allowed", res=MockRes({"x-redlock-status": error_header}, 405) ), ) args = {"alert_id": "P-123456"} command_results = alert_remediate_command(prisma_cloud_v2_client, args) http_request.assert_called_with("PATCH", "alert/remediation/P-123456", resp_type="response") assert command_results.outputs == { "alertId": "P-123456", "successful": False, "failureReason": "remediation unavailable", "errorValue": None, } def test_config_search_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-config-search command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import config_search_command mock_response = {"totalRows": 0, "items": [], "heuristicSearch": True, "preview": False} http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=mock_response) args = {"query": "config from cloud.resource where cloud.region = 'AWS Ohio' ", "limit": "1"} config_search_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "search/config", json_data={ "limit": 1, "query": "config from cloud.resource where cloud.region = 'AWS Ohio' ", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", }, ) def test_config_search_command_pagination_heuristic_search_true_empty_result(mocker, prisma_cloud_v2_client): """ Given: - A search query with heuristic_search set to "true" and a limit that requires multiple pages. - last page return 0 items. When: - prisma-cloud-config-search command is executed. Then: - The http_request method is called multiple times to fetch all pages. - The final result contains items from all pages up to the specified limit. """ from PrismaCloudV2 import config_search_command # Mock responses for multiple pages mock_response_page1 = { "data": {"items": [{"id": "item1"}, {"id": "item2"}], "nextPageToken": "token123"}, "totalRows": 2, "heuristicSearch": True, "preview": False, } mock_response_page2 = { "items": [], "totalRows": 0, } http_request = mocker.patch.object( prisma_cloud_v2_client, "_http_request", side_effect=[mock_response_page1, mock_response_page2], ) args = {"query": "config from cloud.resource", "limit": "5", "heuristic_search": "true"} command_results = config_search_command(prisma_cloud_v2_client, args) # Assert that _http_request was called three times assert http_request.call_count == 2 # Assert calls for initial request and subsequent pages http_request.call_args_list[0].assert_called_with( "POST", "search/config", json_data={ "limit": 5, "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", }, ) http_request.call_args_list[1].assert_called_with( "POST", "search/config/page", json_data={ "limit": 3, # 5 (total limit) - 2 (items from page 1) "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", "pageToken": "token123", }, ) # Assert the final output contains all items expected_outputs = [{"id": "item1"}, {"id": "item2"}] assert command_results.outputs == expected_outputs assert len(command_results.outputs) == 2 # type: ignore def test_config_search_command_no_pagination_heuristic_search_false(mocker, prisma_cloud_v2_client): """ Given: - A search query with heuristic_search set to "false". When: - prisma-cloud-config-search command is executed. Then: - The http_request method is called only once. - The final result contains only the items from the first page. """ from PrismaCloudV2 import config_search_command mock_response_single_page = { "data": { "items": [{"id": "item1"}, {"id": "item2"}, {"id": "item3"}, {"id": "item4"}, {"id": "item5"}], "nextPageToken": "token123", }, "totalRows": 5, "heuristicSearch": False, "preview": False, } http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=mock_response_single_page) args = {"query": "config from cloud.resource", "limit": "5", "heuristic_search": "false"} command_results = config_search_command(prisma_cloud_v2_client, args) # Assert that _http_request was called only once assert http_request.call_count == 1 # Assert the call for the initial request http_request.assert_called_with( "POST", "search/config", json_data={ "limit": 5, "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "false", }, ) # Assert the final output contains only items from the first page expected_outputs = [{"id": "item1"}, {"id": "item2"}, {"id": "item3"}, {"id": "item4"}, {"id": "item5"}] assert command_results.outputs == expected_outputs assert len(command_results.outputs) == 5 # type: ignore def test_config_search_command_pagination_heuristic_search_true(mocker, prisma_cloud_v2_client): """ Given: - A search query with heuristic_search set to "true" and a limit that requires multiple pages. When: - prisma-cloud-config-search command is executed. Then: - The http_request method is called multiple times to fetch all pages. - The final result contains items from all pages up to the specified limit. """ from PrismaCloudV2 import config_search_command # Mock responses for multiple pages mock_response_page1 = { "data": {"items": [{"id": "item1"}, {"id": "item2"}], "nextPageToken": "token123"}, "totalRows": 2, "heuristicSearch": True, "preview": False, } mock_response_page2 = { "items": [{"id": "item3"}, {"id": "item4"}], "totalRows": 2, "nextPageToken": "token456", } mock_response_page3 = {"items": [{"id": "item5"}], "totalRows": 1, "nextPageToken": "token789"} http_request = mocker.patch.object( prisma_cloud_v2_client, "_http_request", side_effect=[mock_response_page1, mock_response_page2, mock_response_page3], ) args = {"query": "config from cloud.resource", "limit": "5", "heuristic_search": "true"} command_results = config_search_command(prisma_cloud_v2_client, args) # Assert that _http_request was called three times assert http_request.call_count == 3 # Assert calls for initial request and subsequent pages http_request.call_args_list[0].assert_called_with( "POST", "search/config", json_data={ "limit": 5, "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", }, ) http_request.call_args_list[1].assert_called_with( "POST", "search/config/page", json_data={ "limit": 3, # 5 (total limit) - 2 (items from page 1) "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", "pageToken": "token123", }, ) http_request.call_args_list[2].assert_called_with( "POST", "search/config/page", json_data={ "limit": 1, # 3 (remaining limit) - 2 (items from page 2) "query": "config from cloud.resource", "sort": [{"direction": "desc", "field": "insertTs"}], "timeRange": {"type": "to_now", "value": "epoch"}, "withResourceJson": "true", "heuristicSearch": "true", "pageToken": "token456", }, ) # Assert the final output contains all items expected_outputs = [{"id": "item1"}, {"id": "item2"}, {"id": "item3"}, {"id": "item4"}, {"id": "item5"}] assert command_results.outputs == expected_outputs assert len(command_results.outputs) == 5 # type: ignore def test_event_search_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-event-search command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import event_search_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"query": "event from cloud.audit_logs where cloud.type = 'aws'", "limit": "5"} event_search_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "search/event", json_data={ "limit": 5, "query": "event from cloud.audit_logs where cloud.type = 'aws'", "timeRange": {"type": "to_now", "value": "epoch"}, }, ) def test_network_search_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-network-search command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import network_search_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = { "query": "network from vpc.flow_record where cloud.account = 'AWS Prod' AND " "source.publicnetwork IN ( 'Suspicious IPs' ) AND bytes > 0 " } network_search_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "search", json_data={ "query": "network from vpc.flow_record where cloud.account = 'AWS Prod' AND " "source.publicnetwork IN ( 'Suspicious IPs' ) AND bytes > 0 ", "timeRange": {"type": "to_now", "value": "epoch"}, }, ) def test_trigger_scan_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-trigger-scan command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import HEADERS, REQUEST_CCS_AUTH_HEADER, trigger_scan_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") headers = HEADERS headers[REQUEST_CCS_AUTH_HEADER] = AUTH_HEADER trigger_scan_command(prisma_cloud_v2_client) http_request.assert_called_with("POST", "code/api/v1/scans/integrations", headers=headers) def test_error_file_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-error-file-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import HEADERS, REQUEST_CCS_AUTH_HEADER, error_file_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"repository": "name/Name", "source_types": "Github", "limit": "10"} headers = HEADERS headers[REQUEST_CCS_AUTH_HEADER] = AUTH_HEADER error_file_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "code/api/v1/errors/files", json_data={"repository": "name/Name", "sourceTypes": ["Github"]}, headers=headers ) def test_resource_get_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-resource-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import resource_get_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} resource_get_command(prisma_cloud_v2_client, args) http_request.assert_called_with("POST", "resource", json_data={"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"}) def test_resource_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-resource-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import resource_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"list_type": "TAG"} resource_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "v1/resource_list", params={"listType": "TAG"}) def test_user_roles_list_command_with_user(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-user-roles-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import user_roles_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value={"id": "a1b2-a1b2"}) args = {"role_id": "a1b2-a1b2"} user_roles_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "user/role/a1b2-a1b2") def test_user_roles_list_command_without_user(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-user-roles-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import user_roles_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {} user_roles_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "user/role") def test_users_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-users-list command is executed Then: - The http request is called with the right arguments and the right result is returned """ from PrismaCloudV2 import users_list_command return_value = [ { "displayName": "User Test", "email": "test@paloaltonetworks.com", "enabled": True, "roles": [ {"id": "a4b4", "name": "Read Only", "type": "Account Group Read Only"}, {"id": "b2n3", "name": "Other Role", "type": "Role"}, ], "type": "USER_ACCOUNT", "username": "test@paloaltonetworks.com", }, { "displayName": "User Other", "email": "other@paloaltonetworks.com", "enabled": True, "roles": [{"id": "a4b4", "name": "Read Only", "type": "Account Group Read Only"}], "type": "USER_ACCOUNT", "username": "other@paloaltonetworks.com", }, { "displayName": "User Not Listed", "email": "mail", "enabled": True, "roles": [{"id": "a4b4", "name": "Read Only", "type": "Account Group Read Only"}], "type": "USER_ACCOUNT", "username": "not_to_appear", }, ] http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=return_value) args = {"usernames": "test@paloaltonetworks.com,other@paloaltonetworks.com"} command_results = users_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "v3/user") assert command_results.outputs == [ { "displayName": "User Test", "email": "test@paloaltonetworks.com", "enabled": True, "roles": [ {"id": "a4b4", "name": "Read Only", "type": "Account Group Read Only"}, {"id": "b2n3", "name": "Other Role", "type": "Role"}, ], "roles names": ["Read Only", "Other Role"], "type": "USER_ACCOUNT", "username": "test@paloaltonetworks.com", }, { "displayName": "User Other", "email": "other@paloaltonetworks.com", "enabled": True, "roles": [{"id": "a4b4", "name": "Read Only", "type": "Account Group Read Only"}], "roles names": ["Read Only"], "type": "USER_ACCOUNT", "username": "other@paloaltonetworks.com", }, ] def test_account_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-account-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import account_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {} account_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "cloud", json_data={"excludeAccountGroupDetails": "false"}) def test_account_status_get_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-account-status-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import account_status_get_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=[{"name": "Config", "status": "ok"}]) args = {"account_ids": "222222333333"} account_status_get_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "account/222222333333/config/status") def test_account_owner_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-account-owner-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import account_owner_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=["foo@test.com"]) args = {"account_ids": "222222333333"} account_owner_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("GET", "cloud/222222333333/owners") def test_host_finding_list_command(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-host-finding-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import host_finding_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "finding_types": "guard_duty_host,guard_duty_iam"} host_finding_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "resource/external_finding", json_data={ "rrn": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "findingType": ["guard_duty_host", "guard_duty_iam"], }, ) def test_permission_list_command_no_next_token(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-permission-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import permission_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"query": "config from iam where source.cloud.service.name = 'EC2'", "limit": "2"} permission_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with( "POST", "api/v1/permission", json_data={"limit": 2, "query": "config from iam where source.cloud.service.name = 'EC2'"} ) def test_permission_list_command_with_next_token(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed, with "next_token" When: - prisma-cloud-permission-list command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import permission_list_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"next_token": "TOKEN", "limit": "2"} permission_list_command(prisma_cloud_v2_client, args) http_request.assert_called_with("POST", "api/v1/permission/page", json_data={"limit": 2, "pageToken": "TOKEN"}) def test_access_key_create_command(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running access_key_create_command to create an access key. Then: Ensure access key created correctly. """ from PrismaCloudV2 import access_key_create_command args = {"name": "key-name"} mock_response = {"id": "id", "secretKey": "secretKey"} mocker.patch.object(Client, "_http_request", return_value=mock_response) command_results = access_key_create_command(prisma_cloud_v2_client, args) assert command_results.outputs == mock_response def test_get_access_keys_without_access_key_given(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running get_access_keys in order to get the list of access keys. Then: Ensure get_access_keys_list called once. """ from PrismaCloudV2 import get_access_keys_command args = {} mocker.patch.object(Client, "_http_request", return_value="") get_access_keys_list_mock = mocker.patch("PrismaCloudV2.get_access_keys_list", return_value={}) get_access_keys_command(prisma_cloud_v2_client, args) get_access_keys_list_mock.assert_called_once_with(prisma_cloud_v2_client, args) def test_get_access_keys_with_access_key_given(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running get_access_keys in order to get data of specific access key. Then: Ensure get_access_key_by_id called once. """ from PrismaCloudV2 import get_access_keys_command args = {"access-key": "test_key"} mocker.patch.object(Client, "_http_request", return_value="") get_access_key_by_id_mock = mocker.patch("PrismaCloudV2.get_access_key_by_id", return_value={}) get_access_keys_command(prisma_cloud_v2_client, args) get_access_key_by_id_mock.assert_called_once_with(prisma_cloud_v2_client, args) def test_get_access_key_by_id(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running get_access_key_by_id in order to get data of specific access key. Then: Ensure function return data about the specific access key with the same access key name. """ from PrismaCloudV2 import get_access_key_by_id args = {"access-key": "test_key"} mock_response = {"id": "id", "name": "test_key", "expiresOn": 0} mocker.patch.object(Client, "_http_request", return_value=mock_response) command_results = get_access_key_by_id(prisma_cloud_v2_client, args) assert command_results.raw_response == mock_response assert command_results.outputs == mock_response assert mock_response.get("name") == args.get("access-key") def test_get_access_keys_list(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running get_access_keys_list in order to get the list of access keys. Then: - Ensure the function return list of access keys in the length of limit. - Ensure the function parse unixtime to human-readable date format. - Ensure readable_output contain all needed features, """ from PrismaCloudV2 import get_access_keys_list mock_response = [ { "id": "id", "name": "test_key", "createdBy": "test_user", "createdTs": "1722861078033", "lastUsedTime": "1722861078033", "status": "active", "expiresOn": 0, "role": {"id": "role_id", "name": "role_name"}, "roleType": "roleType", "username": "username", } ] mocker.patch.object(Client, "_http_request", return_value=mock_response) args = {"limit": 1} command_results = get_access_keys_list(prisma_cloud_v2_client, args) assert command_results.raw_response == mock_response assert command_results.outputs == mock_response readable_output_features = [ "Id", "Name", "Created By", "Created Ts", "Last Used Time", "Status", "Expires On", "Role Id", "Role Name", "Role Type", "Username", ] for feature in readable_output_features: assert feature in command_results.readable_output assert "2024-08-05T12:31:18Z" in command_results.readable_output def test_access_key_disable(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running access_key_disable in order to disable access key. Then: Ensure readable_output returns the correct response. """ from PrismaCloudV2 import access_key_disable_command args = {"access-key": "test_key"} mocker.patch.object(Client, "_http_request", return_value="") command_results = access_key_disable_command(prisma_cloud_v2_client, args) assert command_results.readable_output == "Access key test_key was disabled successfully" def test_access_key_enable(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running access_key_enable in order to enable access key. Then: Ensure readable_output returns the correct response. """ from PrismaCloudV2 import access_key_enable_command args = {"access-key": "test_key"} mocker.patch.object(Client, "_http_request", return_value="") command_results = access_key_enable_command(prisma_cloud_v2_client, args) assert command_results.readable_output == "Access key test_key was enabled successfully" def test_access_key_delete(mocker, prisma_cloud_v2_client): """ Given: A mock PrismaCloudV2 client. When: Running access_key_delete in order to delete access key. Then: Ensure readable_output returns the correct response. """ from PrismaCloudV2 import access_key_delete_command args = {"access-key": "test_key"} mocker.patch.object(Client, "_http_request", return_value="") command_results = access_key_delete_command(prisma_cloud_v2_client, args) assert command_results.readable_output == "Access key test_key was successfully deleted successfully" def test_get_asset(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "asset", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_generic(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-generic-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_generic_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_generic_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_findings(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-findings-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_findings_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_findings_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "findings", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_vulnerabilities(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-vulnerabilities-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_vulnerabilities_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_vulnerabilities_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "vulnerabilities", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_alerts(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-alerts-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_alerts_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_alerts_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "alerts", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_relationships(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-relationships-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_relationships_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_relationships_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "relationships", "limit": 50, "prismaCloudFindingsOnly": False, }, ) def test_get_asset_network(mocker, prisma_cloud_v2_client): """ Given: - All relevant arguments for the command that is executed When: - prisma-cloud-asset-network-get command is executed Then: - The http request is called with the right arguments """ from PrismaCloudV2 import get_asset_network_command http_request = mocker.patch.object(prisma_cloud_v2_client, "_http_request") args = {"asset_id": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25"} get_asset_network_command(prisma_cloud_v2_client, args) http_request.assert_called_with( method="POST", url_suffix="/uai/v1/asset", json_data={ "assetId": "rrn::name:place:111:a1b2:a%3Ajj55-2023-01-29-09-25", "type": "network", "limit": 50, "prismaCloudFindingsOnly": False, }, ) """ HELPER FUNCTIONS TESTS """ @pytest.mark.parametrize( "dict_input, url_field, expected_result", ( input_data.nested_url_field, input_data.outer_url_field, input_data.suffix_with_beginning_char, input_data.url_field_nonexistent, ), ) def test_concatenate_url(prisma_cloud_v2_client, dict_input, url_field, expected_result): """ Given: - A url entry in a dictionary, with the value of the suffix only When: - The url is about to be shown to the user Then: - Update the dictionary given with the url value as base and suffix """ prisma_cloud_v2_client._concatenate_url(dict_input, url_field) assert dict_input == expected_result @pytest.mark.parametrize( "url_to_format, formatted_url", ( ("https://api.prismacloud.io", "https://api.prismacloud.io/"), ("https://app.prismacloud.io/", "https://api.prismacloud.io/"), ("https://other.prismacloud.io/", "https://other.prismacloud.io/"), ("https://app.prismacloud.io/app", "https://api.prismacloud.io/app/"), ), ) def test_format_url(url_to_format, formatted_url): """ Given: - URL is given in integration parameters When: - A command is executed Then: - The URL is changed to support API """ from PrismaCloudV2 import format_url assert format_url(url_to_format) == formatted_url def test_extract_nested_values(): """ Given: - A response with nested fields When: - Creating a human readable response Then: - The wanted nested fields are extracted """ from PrismaCloudV2 import extract_nested_values readable_response = { "id": "P-1234567", "status": "open", "reason": "NEW_ALERT", "firstSeen": 1660654610830, "lastSeen": 1660654610830, "alertTime": 1660654610830, "eventOccurred": 1660654610256, "resource": { "id": "-123456712345679737", "name": "AssumeRole", "account": "MyAccount", "accountId": "123456797356", "regionId": "us-east-1", "resourceType": "EVENT", "data": {"country": "USA"}, "resourceDetailsAvailable": False, }, "triggeredBy": "188612342792", "policy": {"remediable": False}, } nested_headers = { "resource.name": "Resource Name", "resource.id": "Resource ID", "resource.account": "Account", "resource.accountId": "Account ID", "resource.resourceType": "Resource Type", "resource.data.country": "Country", "policy.remediable": "Is Remediable", "id": "Alert ID", } extract_nested_values(readable_response, nested_headers) assert set(nested_headers.values()).issubset(set(readable_response.keys())) assert readable_response["Resource Name"] == "AssumeRole" assert readable_response["Resource ID"] == "-123456712345679737" assert readable_response["Account"] == "MyAccount" assert readable_response["Account ID"] == "123456797356" assert readable_response["Resource Type"] == "EVENT" assert readable_response["Country"] == "USA" assert readable_response["Is Remediable"] is False assert readable_response["Alert ID"] == "P-1234567" def test_extract_nested_values_nonexistent_key(): """ Given: - A response with nested fields, and nested headers that do not exist in it partly or fully When: - Creating a human readable response Then: - The wanted nested fields that exist partly are extracted with None, and that don't exist are not extracted """ from PrismaCloudV2 import extract_nested_values readable_response = { "id": "P-1234567", "status": "open", "reason": "NEW_ALERT", "firstSeen": 1660654610830, "lastSeen": 1660654610830, "alertTime": 1660654610830, "eventOccurred": 1660654610256, "resource": { "id": "-123456712345679737", "name": "AssumeRole", "account": "MyAccount", "accountId": "123456797356", "regionId": "us-east-1", "resourceType": "EVENT", "data": {"country": "USA"}, "resourceDetailsAvailable": False, }, "triggeredBy": "188612342792", } nested_headers = {"resource.othername": "Resource Other Name", "nonexistent.b": "b"} extract_nested_values(readable_response, nested_headers) assert readable_response.get("Resource Other Name") is None def test_change_timestamp_to_datestring_in_dict(): """ Given: - A dictionary with timestamps values in time fields When: - Creating a human readable response Then: - The time fields are changed to datestrings """ from PrismaCloudV2 import change_timestamp_to_datestring_in_dict response_with_timestamp = { "id": "P-11111", "status": "open", "reason": "RESOURCE_UPDATED", "policyId": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5", "firstSeen": 1557254018605, "lastSeen": 1668017403014, "alertTime": 1668017403014, "lastUpdated": 1669196436771, } response_with_datestring = { "id": "P-11111", "status": "open", "reason": "RESOURCE_UPDATED", "policyId": "a11b2cc3-1111-2222-33aa-a1b23ccc4dd5", "firstSeen": "2019-05-07T18:33:38Z", "lastSeen": "2022-11-09T18:10:03Z", "alertTime": "2022-11-09T18:10:03Z", "lastUpdated": "2022-11-23T09:40:36Z", } change_timestamp_to_datestring_in_dict(response_with_timestamp) assert response_with_timestamp == response_with_datestring @pytest.mark.parametrize("date_str, epoch_date", (("07/11/1998", 900115200000), ("now", 1000000130000))) @freeze_time("2001-09-09 01:48:50 UTC") def test_convert_date_to_unix(date_str, epoch_date): """ Given: - A date in a human readable format When: - Creating a time filter for a request Then: - The date in milliseconds since epoch format is returned """ from PrismaCloudV2 import convert_date_to_unix assert convert_date_to_unix(date_str) == epoch_date @pytest.mark.parametrize( "base_case, unit_value, amount_value, time_from, time_to, expected_output", ( input_data.only_unit_value, input_data.unit_amount_and_unit_value, input_data.only_time_to, input_data.time_from_and_time_to, input_data.use_given_base_case, input_data.use_default_base_case, ), ) def test_handle_time_filter(base_case, unit_value, amount_value, time_from, time_to, expected_output): """ Given: - Relevant time filter arguments given from the user When: - Creating the time filter for the request Then: - The right time filter is returned """ from PrismaCloudV2 import handle_time_filter assert handle_time_filter(base_case, unit_value, amount_value, time_from, time_to) == expected_output @pytest.mark.parametrize( "base_case, unit_value, amount_value, time_from, time_to, expected_error", ( input_data.only_amount_value, input_data.wrong_unit_value_relative, input_data.wrong_unit_value_to_now, input_data.only_time_from, input_data.unit_amount_and_time_to, input_data.unit_value_and_time_to, ), ) def test_handle_time_filter_error(base_case, unit_value, amount_value, time_from, time_to, expected_error): """ Given: - Some time filter arguments given from the user, not the way they should When: - Creating the time filter for the request Then: - A relevant error is raised """ from PrismaCloudV2 import handle_time_filter with pytest.raises(DemistoException) as de: handle_time_filter(base_case, unit_value, amount_value, time_from, time_to) assert de.value.message == expected_error @pytest.mark.parametrize("input_filters,expected_parsed_filters", (input_data.with_filters, input_data.empty_filters)) def test_handle_filters(input_filters, expected_parsed_filters): """ Given: - A list of filters given from the user, in the format of filtername=filtervalue When: - Creating the list of filters in the format that the request expects Then: - The returned list is in the right format """ from PrismaCloudV2 import handle_filters filters = argToList(input_filters) parsed_filters = handle_filters(filters) assert parsed_filters == expected_parsed_filters @pytest.mark.parametrize("filter_name", ("no_equal_sign", "too=many=equal_signs", " ", "no_value= ", "=no_name")) def test_handle_filters_error(filter_name): """ Given: - A list of filters given from the user, in a wrong format When: - Creating the list of filters in the format that the request expects Then: - An error is raised with the name of the wrong filter """ from PrismaCloudV2 import handle_filters filters = argToList(filter_name) with pytest.raises(DemistoException) as de: handle_filters(filters) assert ( de.value.message == f'Filters should be in the format of "filtername1=filtervalue1,filtername2=filtervalue2". ' f'The filter "{filters[0]}" doesn\'t meet this requirement.' ) def test_handle_tags(): """ Given: - A list of tags given from the user, in the format of tagkey=tagvalue When: - Creating the list of tags in the format that the request expects Then: - The returned list is in the right format """ from PrismaCloudV2 import handle_tags filters = argToList("Environment=local.resource_prefix.value") parsed_filters = handle_tags(filters) assert parsed_filters == [{"key": "Environment", "value": "local.resource_prefix.value"}] @pytest.mark.parametrize("tag_name", ("no_equal_sign", "too=many=equal_signs", " ", "no_value= ", "=no_key")) def test_handle_tags_error(tag_name): """ Given: - A list of tags given from the user, in a wrong format When: - Creating the list of tags in the format that the request expects Then: - An error is raised with the name of the wrong tag """ from PrismaCloudV2 import handle_tags filters = argToList(tag_name) with pytest.raises(DemistoException) as de: handle_tags(filters) assert ( de.value.message == f'Tags should be in the format of "tagkey1=tagvalue1,tagkey2=tagvalue2". ' f'The tag "{filters[0]}" doesn\'t meet this requirement.' ) def test_validate_array_arg(): """ Given: - An array argument given from the user, one having right values and second having wrong values When: - Preparing for a request and checking that the provided arguments have the right values Then: - An error is raised only when an argument value that is not in the list of available options is found """ from PrismaCloudV2 import validate_array_arg options = ["good", "another_good", "more_good"] validate_array_arg(argToList("good,another_good"), "Good Name", options) # should just pass with pytest.raises(DemistoException) as de: validate_array_arg(argToList("more_good,bad,good"), "Bad Name", options) assert de.value.message == "Bad Name values are unexpected, must be of the following: good, another_good, more_good." def test_remove_empty_values(): """ Given: - A dictionary to remove empty values from When: - Removing empty values from the given dict and from the nested dicts and lists in it Then: - The returned dictionary is the original dictionary without the empty values and nested values """ from PrismaCloudV2 import remove_empty_values dict_input = { "empty1": [], "empty2": None, "empty3": False, "empty4": {}, "empty5": "", "empty6": {"v1": None, "v2": [], "v3": {}}, "empty7": {"v1": {"empty": {"nested_empty": None}}}, "empty8": [{"v1": None}, {"v2": ""}], "with_value1": "text", "with_value2": ["v1", "v2"], "with_value3": {"v1", "v2"}, "with_value4": {"v1": None, "v2": "v3"}, "with_value5": { "timeRange": {"type": "to_now", "value": "epoch"}, "filters": [ {"name": "string1", "operator": "=", "value": "string1"}, {"name": "string2", "operator": "=", "value": "string2"}, ], }, "with_value6": "false", } dict_expected_output = { "with_value1": "text", "with_value2": ["v1", "v2"], "with_value3": {"v1", "v2"}, "with_value4": {"v2": "v3"}, "with_value5": { "timeRange": {"type": "to_now", "value": "epoch"}, "filters": [ {"name": "string1", "operator": "=", "value": "string1"}, {"name": "string2", "operator": "=", "value": "string2"}, ], }, "with_value6": "false", } assert remove_empty_values(dict_input) == dict_expected_output @pytest.mark.parametrize( "page_size, page_number, offset", ( (100, 1, 0), (2, 2, 2), (5, 3, 10), ), ) def test_calculate_offset(page_size, page_number, offset): """ Given: - 'page_size' and 'page_number' arguments When: - A command that has paging is executed Then: - Returns the right offset that will be sent to the request """ from PrismaCloudV2 import calculate_offset assert calculate_offset(page_size, page_number) == (page_size, offset) def test_extract_namespace(): """ Given: - A response to extract namespace from. When: - Extracting namespaces from resource list items. Then: - The response is updated with the right namespaces. """ from PrismaCloudV2 import extract_namespace res = [ { "id": "1", "name": "No namespaces", "resourceListType": "TAG", "description": "some values", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1611682405313, "members": [{"env": "env"}, {"projec": "project"}, {"securit": "security"}], }, { "id": "2", "name": "Members is strings", "resourceListType": "RESOURCE_GROUP", "description": "", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1648181381197, "members": ["common"], }, { "id": "3", "name": "Have namespaces", "resourceListType": "GROUP", "description": "Have namespaces", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1648507192479, "members": [ { "hosts": ["*"], "appIDs": ["*"], "images": ["*"], "labels": ["*"], "clusters": ["*"], "codeRepos": ["*"], "functions": ["*"], "containers": ["*"], "namespaces": ["*"], } ], }, ] expected_res = [ { "id": "1", "name": "No namespaces", "resourceListType": "TAG", "description": "some values", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1611682405313, "members": [{"env": "env"}, {"projec": "project"}, {"securit": "security"}], }, { "id": "2", "name": "Members is strings", "resourceListType": "RESOURCE_GROUP", "description": "", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1648181381197, "members": ["common"], }, { "id": "3", "name": "Have namespaces", "resourceListType": "GROUP", "description": "Have namespaces", "lastModifiedBy": "name@company.com", "lastModifiedTs": 1648507192479, "members": [ { "hosts": ["*"], "appIDs": ["*"], "images": ["*"], "labels": ["*"], "clusters": ["*"], "codeRepos": ["*"], "functions": ["*"], "containers": ["*"], "namespaces": ["*"], } ], "namespaces": ["*"], }, ] extract_namespace(res) assert res == expected_res """ FETCH HELPER FUNCTIONS TESTS """ @pytest.mark.parametrize( "given_alert, expected_severity", ( ({"policy": {"severity": "high"}}, IncidentSeverity.HIGH), ({"policy": {"severity": "medium"}}, IncidentSeverity.MEDIUM), ({"policy": {"severity": "low"}}, IncidentSeverity.LOW), ({"policy": {"severity": "critical"}}, IncidentSeverity.CRITICAL), ({"policy": {"severity": "informational"}}, IncidentSeverity.INFO), ({"policy": {"severity": "other"}}, IncidentSeverity.UNKNOWN), ({"policy": {}}, IncidentSeverity.UNKNOWN), ({}, IncidentSeverity.UNKNOWN), ), ) def test_translate_severity(given_alert, expected_severity): """ Given: - An alert with or without the severity of their policy When: - Fetching incident and creating the incident context from a given alert Then: - Returns the right severity for this alert """ from PrismaCloudV2 import translate_severity assert translate_severity(given_alert) == expected_severity def test_expire_stored_ids(): """ Given: - Fetched alerts IDs with their alert time - The next fetch run time according to the last alert time - The fetch look back time given from the user When: - Fetching incident and preparing the values to save for the next run Then: - Returns the fetched alerts IDs with their alert time, that their alert time will be fetched in the next fetch """ from PrismaCloudV2 import FETCH_LOOK_BACK_TIME, expire_stored_ids updated_last_run_time = 1000000000000 fetched_ids = { "N-111111": 1000000000000, # same time "P-222222": 999996400000, # 1 hour before (FETCH_LOOK_BACK_TIME*3) "P-333333": 999998800000, # 20 minutes before "P-444444": 999996340000, # 61 minutes before "N-555555": 999992800000, # 2 hours before "N-666666": 999996460000, # 59 minutes before } expected_fetched_ids = { "N-111111": 1000000000000, # same time "P-222222": 999996400000, # 1 hour before "P-333333": 999998800000, # 20 minutes before "N-666666": 999996460000, # 59 minutes before } assert expire_stored_ids(fetched_ids, updated_last_run_time, FETCH_LOOK_BACK_TIME) == expected_fetched_ids @pytest.mark.parametrize( "now, first_fetch, look_back, last_run_time, expected_fetch_time_range", ( input_data.start_at_first_fetch_default, input_data.start_at_first_fetch, input_data.start_at_first_fetch2, input_data.start_at_last_run_time_with_look_back, input_data.start_at_last_run_time, ), ) @freeze_time("2023-02-10 11:00:00 UTC") def test_calculate_fetch_time_range(now, first_fetch, look_back, last_run_time, expected_fetch_time_range): """ Given: - All relevant times to calculate the fetch time range When: - Creating the arguments for the fetch incidents request Then: - Returns the right fetch time range for the request """ from PrismaCloudV2 import calculate_fetch_time_range assert calculate_fetch_time_range(now, first_fetch, look_back, last_run_time) == expected_fetch_time_range @pytest.mark.parametrize( "last_run_epoch_time, look_back_minutes, expected_epoch_time", ( (1676023200000, 20, 1676022000000), (1676023200000, 60, 1676019600000), (1676023200000, 0, 1676023200000), ), ) def test_add_look_back(last_run_epoch_time, look_back_minutes, expected_epoch_time): """ Given: - Last run time and time in minutes to look back. When: - Creating the arguments for the fetch incidents request and calculating the time to start fetching from Then: - Returns the right fetch time with look back added to it """ from PrismaCloudV2 import add_look_back assert add_look_back(last_run_epoch_time, look_back_minutes) == expected_epoch_time @pytest.mark.parametrize( "limit, request_results, expected_incidents, expected_fetched_ids, expected_updated_last_run_time", ( input_data.low_limit_for_request, input_data.exactly_limit_for_request, input_data.more_than_limit_for_request, input_data.high_limit_for_request, ), ) @freeze_time("2001-09-09 01:49:00 UTC") def test_fetch_request( mocker, prisma_cloud_v2_client, limit, request_results, expected_incidents, expected_fetched_ids, expected_updated_last_run_time, ): """ Given: - All needed arguments for the fetch request When: - Fetching incidents, doing the request and filtering the alerts got from Prisma Cloud Then: - Returns the incidents up to the limit given, the fetched IDs and the updated last run time according to the limit given """ from PrismaCloudV2 import fetch_request mocker.patch.object(prisma_cloud_v2_client, "_http_request", side_effect=request_results) fetched_ids = {"P-111111": 1000000110000, "P-222222": 999996400000} now = 1000000140000 assert fetch_request( client=prisma_cloud_v2_client, fetched_ids=fetched_ids, filters=[], limit=limit, now=now, time_range={"type": "absolute", "value": {"endTime": now, "startTime": 1000000110000}}, ) == (expected_incidents, expected_fetched_ids, expected_updated_last_run_time) @pytest.mark.parametrize( "limit, expected_incidents, expected_updated_fetched_ids", ( input_data.low_limit_for_filter, input_data.exactly_limit_for_filter, input_data.high_limit_for_filter, ), ) def test_filter_alerts(prisma_cloud_v2_client, limit, expected_incidents, expected_updated_fetched_ids): """ Given: - The IDs that were already fetched, the items in the response from the request and the limit of incidents to return When: - Fetching incidents and filtering the alerts got from Prisma Cloud Then: - Returns the incidents up to the limit given, without those that were already fetched """ from PrismaCloudV2 import filter_alerts fetched_ids = {"N-111111": 1000000000000, "P-222222": 999996400000} response_items = [ {"id": "N-111111", "alertTime": 1000000000000, "policy": {"name": "Policy One", "severity": "high"}}, input_data.truncated_alert6, input_data.truncated_alert7, ] assert filter_alerts(prisma_cloud_v2_client, fetched_ids, response_items, limit) == expected_incidents assert fetched_ids == expected_updated_fetched_ids @pytest.mark.parametrize( "limit, expected_incidents, expected_updated_fetched_ids", ( input_data.low_limit_for_filter__updated_alert_time, input_data.exactly_limit_for_filter__updated_alert_time, input_data.high_limit_for_filter__updated_alert_time, ), ) def test_filter_alerts_with_updated_alert_time(prisma_cloud_v2_client, limit, expected_incidents, expected_updated_fetched_ids): """ Given: - A set of fetched IDs with an alert ID and its timestamp. - A list of alerts from Prisma Cloud, including an alert with the same ID but a different timestamp. - A limit on the number of incidents to return. When: - Filtering the alerts from Prisma Cloud, considering the fetched IDs and the limit. Then: - Returns the expected incidents up to the limit, excluding those already fetched. - Updates the fetched IDs dictionary with the new timestamp for the alert with the updated timestamp. """ from PrismaCloudV2 import filter_alerts fetched_ids = {"N-111111": 1000000000000, "P-222222": 999996400000} response_items = [ {"id": "N-111111", "alertTime": 1000000000001, "policy": {"name": "Policy One", "severity": "high"}}, input_data.truncated_alert6, input_data.truncated_alert7, ] assert filter_alerts(prisma_cloud_v2_client, fetched_ids, response_items, limit) == expected_incidents assert fetched_ids == expected_updated_fetched_ids @pytest.mark.parametrize( "alert, expected_incident_context", ( (input_data.truncated_alert6, input_data.incident6), (input_data.truncated_alert7, input_data.incident7), (input_data.truncated_alert_no_policy, input_data.incident_no_policy), (input_data.full_alert, input_data.full_incident), ), ) def test_alert_to_incident_context(prisma_cloud_v2_client, alert, expected_incident_context): """ Given: - An alert as it was got in the response of the request to Prisma Cloud When: - Fetching incidents and creating XSOAR incidents out of them Then: - Returns the incident that was created from the alert given """ from PrismaCloudV2 import add_mirroring_fields, alert_to_incident_context add_mirroring_fields(prisma_cloud_v2_client, alert) assert alert_to_incident_context(alert) == expected_incident_context @pytest.mark.parametrize( "last_run, params, incidents, fetched_ids, updated_last_run_time, expected_fetched_ids, expected_updated_last_run_time", ( input_data.fetch_first_run, input_data.fetch_no_incidents, input_data.fetch_with_last_run, input_data.fetch_with_expiring_ids, ), ) @freeze_time("2001-09-09 01:48:50 UTC") def test_fetch_incidents( mocker, prisma_cloud_v2_client, last_run, params, incidents, fetched_ids, updated_last_run_time, expected_fetched_ids, expected_updated_last_run_time, ): """ Given: - Last run data and parameters for the fetch request When: - Fetching incidents Then: - Returns the incidents up to the limit given, the fetched IDs and the updated last run time - The updated last run time is the later between the first fetch time and the alert time of the last fetched incident """ from PrismaCloudV2 import fetch_incidents mocker.patch("PrismaCloudV2.fetch_request", return_value=(incidents, fetched_ids, updated_last_run_time)) assert fetch_incidents(prisma_cloud_v2_client, last_run, params) == ( incidents, expected_fetched_ids, expected_updated_last_run_time, ) """ MIRRORING FUNCTIONS TESTS """ @pytest.fixture @patch("PrismaCloudV2.Client.generate_auth_token") def prisma_cloud_v2_mirroring_client(mocker): from PrismaCloudV2 import HEADERS, REQUEST_CSPM_AUTH_HEADER headers = HEADERS headers[REQUEST_CSPM_AUTH_HEADER] = AUTH_HEADER return Client( server_url="https://api.prismacloud.io/", verify=True, proxy=False, headers=headers, username="username", password="password", mirror_direction="Incoming And Outgoing", close_incident=True, close_alert=True, is_test_module=False, ) def test_get_modified_remote_data_command(mocker, prisma_cloud_v2_mirroring_client): """ Given - arguments - lastUpdate time. - raw prisma cloud alerts (alert_search_request raw response). When - Running the get_modified_remote_data_command. Then - Verify that the returned value is a list of incidents IDs that were modified since the lastUpdate time. """ from PrismaCloudV2 import get_modified_remote_data_command mocker.patch("PrismaCloudV2.Client.alert_search_request", return_value={"items": input_data.alert_search_request_response}) last_update = "2023-08-16T08:17:09Z" args = {"lastUpdate": last_update} params = {"filters": "alert.status=open,alert.status=dismissed,alert.status=snoozed,alert.status=resolved"} result = get_modified_remote_data_command(client=prisma_cloud_v2_mirroring_client, args=args, params=params) assert result.modified_incident_ids == ["P-1111111", "P-1111112", "P-1111113"] @pytest.mark.parametrize( "raw_response, expected_updated_object", [ ( input_data.alert_get_details_request_dismissed_alert_raw_response, input_data.get_remote_alert_data_dismissed_alert_updated_object, ), ( input_data.alert_get_details_request_snoozed_alert_raw_response, input_data.get_remote_alert_data_snoozed_alert_updated_object, ), ( input_data.alert_get_details_request_resolved_alert_raw_response, input_data.get_remote_alert_data_resolved_alert_updated_object, ), ( input_data.alert_get_details_request_reopened_alert_raw_response, input_data.get_remote_alert_data_reopened_alert_updated_object, ), ], ) def test_get_remote_alert_data(mocker, prisma_cloud_v2_mirroring_client, raw_response, expected_updated_object): """ Given 1. Raw response of the alert_get_details_request with data of a dismissed alert. 2. Raw response of the alert_get_details_request with data of a snoozed alert. 3. Raw response of the alert_get_details_request with data of a resolved alert. 4. Raw response of the alert_get_details_request with data of a reopened alert. When - Running the get_remote_alert_data function. Then - Verify that the updated_object is as expected. """ from PrismaCloudV2 import get_remote_alert_data remote_alert_id = "test id" mocker.patch("PrismaCloudV2.Client.alert_get_details_request", return_value=raw_response) alert_details, updated_object = get_remote_alert_data(prisma_cloud_v2_mirroring_client, remote_alert_id) assert alert_details == raw_response assert updated_object == expected_updated_object @pytest.mark.parametrize( "updated_mirrored_object, function_calls", [ (input_data.get_remote_alert_data_dismissed_alert_updated_object, [1, 0]), (input_data.get_remote_alert_data_snoozed_alert_updated_object, [1, 0]), (input_data.get_remote_alert_data_resolved_alert_updated_object, [1, 0]), (input_data.get_remote_alert_data_reopened_alert_updated_object, [0, 1]), ], ) def test_set_xsoar_incident_entries(mocker, prisma_cloud_v2_mirroring_client, updated_mirrored_object, function_calls): """ Given 1. A mirrored updated_object of a dismissed alert. 2. A mirrored updated_object of a snoozed alert. 3. A mirrored updated_object of a resolved alert. 4. A mirrored updated_object of a re-opened alert. When - Running the set_xsoar_incident_entries function. Then 1-3. Verify that the close_incident_in_xsoar function was called once, and that the reopen_incident_in_xsoar function wasn't called. 4. Verify that the reopen_incident_in_xsoar function was called once, and that the close_incident_in_xsoar function wasn't called. """ from PrismaCloudV2 import set_xsoar_incident_entries mock_close_xsoar_incident = mocker.patch("PrismaCloudV2.close_incident_in_xsoar", return_value=None) mock_reopen_xsoar_incident = mocker.patch("PrismaCloudV2.reopen_incident_in_xsoar", return_value=None) set_xsoar_incident_entries(updated_mirrored_object, "P-1111111") assert mock_close_xsoar_incident.call_count == function_calls[0] assert mock_reopen_xsoar_incident.call_count == function_calls[1] @pytest.mark.parametrize( "mirrored_status, mirrored_dismissal_note", [ ("dismissed", "test_dismissed"), ("snoozed", "test_snoozed"), ("resolved", "test_resolved"), ("resolved", ""), ], ) def test_close_incident_in_xsoar(mirrored_status, mirrored_dismissal_note): """ Given - A mirrored remoter alert id, a status and a dismissal note. When - Running the close_incident_in_xsoar function. Then - Verify that the close xsoar entry created as expected. """ from PrismaCloudV2 import close_incident_in_xsoar remote_alert_id = "test id" close_entry = close_incident_in_xsoar(remote_alert_id, mirrored_status, mirrored_dismissal_note) close_entry_contents = close_entry.get("Contents") assert close_entry_contents.get("dbotIncidentClose") is True assert close_entry_contents.get("rawCloseReason") == mirrored_status assert close_entry_contents.get("closeReason") == f"Alert was {mirrored_status} on Prisma Cloud." if not mirrored_dismissal_note: # resolved (case 4) assert close_entry_contents.get("closeNotes") == "resolved" else: assert close_entry_contents.get("closeNotes") == mirrored_dismissal_note def test_reopen_incident_in_xsoar(): """ Given - A mirrored remote alert id. When - Running the reopen_incident_in_xsoar function. Then - Verify that the reopen xsoar entry created as expected. """ from PrismaCloudV2 import reopen_incident_in_xsoar remote_alert_id = "test id" reopen_entry = reopen_incident_in_xsoar(remote_alert_id) close_entry_contents = reopen_entry.get("Contents") assert close_entry_contents.get("dbotIncidentReopen") is True @pytest.mark.parametrize( "mirrored_data, updated_object, expected_entry", [ ( input_data.alert_get_details_request_dismissed_alert_raw_response, input_data.get_remote_alert_data_dismissed_alert_updated_object, input_data.dismissed_closed_xsoar_entry, ), ( input_data.alert_get_details_request_snoozed_alert_raw_response, input_data.get_remote_alert_data_snoozed_alert_updated_object, input_data.snoozed_closed_xsoar_entry, ), ( input_data.alert_get_details_request_resolved_alert_raw_response, input_data.get_remote_alert_data_resolved_alert_updated_object, input_data.resolved_closed_xsoar_entry, ), ( input_data.alert_get_details_request_reopened_alert_raw_response, input_data.get_remote_alert_data_reopened_alert_updated_object, input_data.reopened_closed_xsoar_entry, ), ], ) def test_get_remote_data_command(mocker, prisma_cloud_v2_mirroring_client, mirrored_data, updated_object, expected_entry): """ Given - A mirrored data, updated object (the object containing only the fields that should be mirrored) of a: 1. Dismissed alert 2. Snoozed alert 3. Resolved alert 4. Re-opened alert When - Running the get_remote_data_command. Then - Verify that the GetRemoteDataResponse object contains the updated object as the mirrored_object, and the expected xsoar entry. """ from PrismaCloudV2 import get_remote_data_command args = {"id": "test id", "lastUpdate": "2023-08-16T08:17:09Z"} mocker.patch("PrismaCloudV2.get_remote_alert_data", return_value=(mirrored_data, updated_object)) result = get_remote_data_command(prisma_cloud_v2_mirroring_client, args) entry = result.entries[0].get("Contents") if "closed" in entry: # removing the closed field cause time fields could be problematic for testing entry.pop("closed") assert entry == expected_entry assert result.mirrored_object == updated_object @pytest.mark.parametrize( "mirrored_data, updated_object", [ ( input_data.alert_get_details_request_dismissed_alert_raw_response, input_data.get_remote_alert_data_dismissed_alert_updated_object, ), ( input_data.alert_get_details_request_reopened_alert_raw_response, input_data.get_remote_alert_data_reopened_alert_updated_object, ), ], ) def test_get_remote_data_command_close_incident_false(mocker, prisma_cloud_v2_mirroring_client, mirrored_data, updated_object): """ Given - A mirrored data, updated object (the object containing only the fields that should be mirrored) of an alert: 1. Closed alert. 2. Reopened alert. - A client with the field close_incident = False (which indicates that the user doest want to close or to re-open xsaor incidents as part of the mirror in process). When - Running the get_remote_data_command. Then - Verify that the GetRemoteDataResponse object contains the updated object as the mirrored_object, and no XSOAR entries (because we don't want to close\re-open the mirrored incident). """ from PrismaCloudV2 import get_remote_data_command args = {"id": "test id", "lastUpdate": "2023-08-16T08:17:09Z"} mocker.patch("PrismaCloudV2.get_remote_alert_data", return_value=(mirrored_data, updated_object)) # Set the incident_close integration parameter to False: prisma_cloud_v2_mirroring_client.close_incident = False result = get_remote_data_command(prisma_cloud_v2_mirroring_client, args) assert result.entries == [] assert result.mirrored_object == updated_object @pytest.mark.parametrize( "incident_status, whether_to_close, whether_to_reopen, expected_result", [ (IncidentStatus.DONE, True, False, [1, 0]), (IncidentStatus.DONE, False, False, [0, 0]), (IncidentStatus.ACTIVE, False, True, [0, 1]), (IncidentStatus.ACTIVE, False, False, [0, 0]), (IncidentStatus.ARCHIVE, False, True, [0, 0]), (IncidentStatus.ARCHIVE, True, False, [0, 0]), (IncidentStatus.PENDING, False, True, [0, 0]), (IncidentStatus.PENDING, True, False, [0, 0]), ], ) def test_update_remote_alert( mocker, prisma_cloud_v2_mirroring_client, incident_status, whether_to_close, whether_to_reopen, expected_result ): """ Given Incident Status, mock response of the whether_to_close_in_prisma_cloud function and a mock response of the whether_to_reopen_in_prisma_cloud function: 1. Closed, Yes, No. 2. Closed, No, No. 3. Open, No, Yes. 4. Open, No, No. 5. Archive, No, Yes. 6. Archive, Yes, No. 7. Pending, No, Yes. 8. Pending, Yes, No. When - Running the update_remote_alert function. Then 1. Verify that the close_alert_in_prisma_cloud function was called once, and that the reopen_alert_in_prisma_cloud function wasn't called. 2. Verify that none of the functions were called. 3. Verify that the reopen_alert_in_prisma_cloud function was called once, and that the close_alert_in_prisma_cloud function wasn't called. 4. Verify that none of the functions were called. 5 -8. Verify that none of the functions were called. """ from PrismaCloudV2 import update_remote_alert mocker.patch("PrismaCloudV2.whether_to_close_in_prisma_cloud", return_value=whether_to_close) mocker.patch("PrismaCloudV2.whether_to_reopen_in_prisma_cloud", return_value=whether_to_reopen) mock_close_prisma_alert = mocker.patch("PrismaCloudV2.close_alert_in_prisma_cloud", return_value=None) mock_reopen_prisma_alert = mocker.patch("PrismaCloudV2.reopen_alert_in_prisma_cloud", return_value=None) update_remote_alert(prisma_cloud_v2_mirroring_client, {}, incident_status, "test_id") assert mock_close_prisma_alert.call_count == expected_result[0] assert mock_reopen_prisma_alert.call_count == expected_result[1] @pytest.mark.parametrize( "user_selection, delta, expected_result", [ (True, {"closeReason": "USER_DISMISSED", "closingUserId": "", "closeNotes": "test"}, True), (True, {"closeReason": "USER_DISMISSED"}, True), (True, {"closingUserId": ""}, True), (True, {"closeNotes": "test"}, True), (True, {}, False), (False, {"closeReason": "USER_DISMISSED", "closingUserId": "", "closeNotes": "test"}, False), ], ) def test_whether_to_close_in_prisma_cloud(user_selection, delta, expected_result): """ Given - The user selection regarding mirroring out closing of an XSOAR incident (determined in the 'close_alert' integration parameter), the mirrored incident delta. 1. True, delta includes all closing fields. 2-4. True, delta includes some of the closing fields. 5. True, delta doesn't include closing fields. 6. False, delta includes all closing fields. When - Running the whether_to_close_in_prisma_cloud function. Then - Verify that the result is as expected: 1-4: True. 5-6. False. """ from PrismaCloudV2 import whether_to_close_in_prisma_cloud assert whether_to_close_in_prisma_cloud(user_selection, delta) == expected_result @pytest.mark.parametrize( "user_selection, delta, expected_result", [ (True, {"closingUserId": ""}, True), (True, {}, False), (False, {"closingUserId": ""}, False), ], ) def test_whether_to_reopen_in_prisma_cloud(user_selection, delta, expected_result): """ Given - The user selection regarding mirroring out re-opening of an XSOAR incident (determined in the 'close_alert' integration parameter), the mirrored incident delta. 1. True, delta includes the closingUserId field. 2. True, delta doesn't include the closingUserId field. 3. False, delta includes the closingUserId field. When - Running the whether_to_reopen_in_prisma_cloud function. Then - Verify that the result is as expected: 1. True. 2. False. 3. False. """ from PrismaCloudV2 import whether_to_reopen_in_prisma_cloud assert whether_to_reopen_in_prisma_cloud(user_selection, delta) == expected_result def test_close_alert_in_prisma_cloud(mocker, prisma_cloud_v2_mirroring_client): """ Given - A list of incident IDs to close in Prisma, a delta of the incident, and a time filter. When - Running the close_alert_in_prisma_cloud function. Then - Verify that the Client.alert_dismiss_request has called with expected args. """ from PrismaCloudV2 import close_alert_in_prisma_cloud incident_ids_to_close = ["P-1111111"] delta = {"closeReason": "USER_DISMISSED", "closingUserId": "", "closeNotes": "test"} time_filter = {"type": "to_now", "value": "epoch"} # base case mocker.patch("PrismaCloudV2.handle_time_filter", return_value=time_filter) mock_alert_dismiss_request = mocker.patch("PrismaCloudV2.Client.alert_dismiss_request", return_value=None) close_alert_in_prisma_cloud(prisma_cloud_v2_mirroring_client, incident_ids_to_close, delta) assert mock_alert_dismiss_request.call_args.kwargs == { "dismissal_note": "Closed by XSOAR - Closing Reason: USER_DISMISSED, Closing Notes: test.", "time_range": time_filter, "alert_ids": incident_ids_to_close, } def test_reopen_alert_in_prisma_cloud(mocker, prisma_cloud_v2_mirroring_client): """ Given - A list of incident IDs to reopen in Prisma, and a time filter. When - Running the reopen_alert_in_prisma_cloud function. Then - Verify that the Client.alert_reopen_request has called with expected args. """ from PrismaCloudV2 import reopen_alert_in_prisma_cloud incident_ids_to_reopen = ["P-1111111"] time_filter = {"type": "to_now", "value": "epoch"} # base case mocker.patch("PrismaCloudV2.handle_time_filter", return_value=time_filter) mock_alert_reopen_request = mocker.patch("PrismaCloudV2.Client.alert_reopen_request", return_value=None) reopen_alert_in_prisma_cloud(prisma_cloud_v2_mirroring_client, incident_ids_to_reopen) assert mock_alert_reopen_request.call_args.kwargs == {"time_range": time_filter, "alert_ids": incident_ids_to_reopen} @pytest.mark.parametrize( "args, expected_call_count", [ ({"incidentChanged": True, "remoteId": "P-1111111", "status": IncidentStatus.ACTIVE, "delta": {"closingUserId": ""}}, 1), ( { "incidentChanged": True, "remoteId": "P-1111111", "status": IncidentStatus.DONE, "delta": {"closeReason": "USER_DISMISSED", "closingUserId": "", "closeNotes": "test"}, }, 1, ), ({"incidentChanged": False, "remoteId": "P-1111111", "status": IncidentStatus.ACTIVE, "delta": {}}, 0), ], ) def test_update_remote_system_command(mocker, prisma_cloud_v2_mirroring_client, args, expected_call_count): """ Given - Demisto args object contains: 1. incidentChanged field with True value, the remote alert ID, the xsoar incident status - open, and the delta. 2. incidentChanged field with True value, the remote alert ID, the xsoar incident status - closed, and the delta. 3. incidentChanged field with False value, the remote alert ID, the xsoar incident status, and an empty delta. When - Running the update_remote_system_command. Then - Verify that: 1-2. The update_remote_alert function was called (cause mirror out process should be performed (incidentChanged=True). 3. The update_remote_alert function wasn't called (cause mirror out process should not be performed (incidentChanged=False). """ from PrismaCloudV2 import update_remote_system_command mock_update_remote_alert = mocker.patch("PrismaCloudV2.update_remote_alert", return_value=None) result = update_remote_system_command(prisma_cloud_v2_mirroring_client, args) assert mock_update_remote_alert.call_count == expected_call_count assert result == "P-1111111" def test_remove_additional_resource_fields(prisma_cloud_v2_client): """ Given - Results of config_search_command. When - Running the config_search_command. Then - Verify that remove_additional_resource_fields removes only the required fields. """ from PrismaCloudV2 import remove_additional_resource_fields input = [ { "data": { "disks": [{"mode": "READ_WRITE", "shieldedInstanceInitialState": "s_val"}], "metadata": { "items": [ {"key": "configure-sh", "value": "configure_sh_val"}, {"key": "not-removed-value", "value": "not_removed_value_val"}, ] }, } } ] expected = [ { "data": { "disks": [{"mode": "READ_WRITE"}], "metadata": {"items": [{"key": "not-removed-value", "value": "not_removed_value_val"}]}, } } ] remove_additional_resource_fields(items=input) assert input == expected labels_data = [ ( [{"metadata": {"imageName": "weaveworksdemos/front-end:0.3.12"}, "label": "Image Referencer"}], # case one dict ["Image Referencer"], ), # expected ( [ {"label": "Breaking Change Fix"}, {"metadata": {"imageName": "weaveworksdemos/front-end:0.3.12"}, "label": "Image Referencer"}, ], # case two dicts ["Breaking Change Fix", "Image Referencer"], ), # expected ( ["CustomPolicy"], # case list ["CustomPolicy"], ), # expected ( [], # case empty list None, ), # expected ] @pytest.mark.parametrize("labels, expected", labels_data) def test_get_labels(labels, expected): """ Given list of labels as found in a raw response When Converting the labels from a code issue into a list of strings in get_labels function. Then Verify the list of labels. """ from PrismaCloudV2 import get_labels res = get_labels(labels) assert res == expected valid_args = [ ({"license_type": "OSI_APACHE", "some_filter": "value1", "search_scopes": "scope1", "search_term": "term1"}), ({"license_type": "OSI_APACHE", "some_filter": "value1", "search_scopes": "scope1", "limit": 20, "search_term": "term1"}), ({"page_size": 50, "page": 50, "some_filter": "value1"}), ] invalid_args = [ ( {"license_type": "invalid_type", "some_filter": "value1"}, DemistoException, "Invalid license type. For the list of valid license types go to- https://pan.dev/prisma-cloud/api/code/get-periodic-findings/#request", ), ( {"search_scopes": "scope1", "search_term": "term1", "limit": 10}, DemistoException, "At least one filtering argument is required, excluding `search_scopes`, `search_term`, and `limit`. For example, \ `fixable_only` or 'branch`", ), ( {}, DemistoException, "At least one filtering argument is required, excluding `search_scopes`, `search_term`, and `limit`. For example, \ `fixable_only` or 'branch`", ), ( {"search_scopes": "scope1", "some_filter": "value1"}, DemistoException, "The `search_term` argument is required when specifying `search_scopes`.", ), ({"page": 40, "some_filter": "value1"}, DemistoException, "Please provide both `page` and `page_size` arguments."), ({"page_size": 50, "some_filter": "value1"}, DemistoException, "Please provide both `page` and `page_size` arguments."), ({"page_size": 1001, "page": 40, "some_filter": "value1"}, DemistoException, "`Page_size` argument can't be more than 1000."), ] @pytest.mark.parametrize("given", valid_args) def test_valid_cases(given): """ Given Valid filtering arguments including license type When Running validate_code_issues_list_args function with these arguments Then The function should not raise any exceptions """ from PrismaCloudV2 import validate_code_issues_list_args validate_code_issues_list_args(given) @pytest.mark.parametrize("given, expected_exception, expected_message", invalid_args) def test_invalid_cases(given, expected_exception, expected_message): """ Given Invalid filtering arguments or missing required filters When Running validate_code_issues_list_args function with these arguments Then The function should raise the expected exception with the correct message """ from PrismaCloudV2 import validate_code_issues_list_args with pytest.raises(expected_exception) as exc_info: validate_code_issues_list_args(given) assert str(exc_info.value) == expected_message def test_code_issues_list_command__has_next(mocker, prisma_cloud_v2_client): """ Given has_next feild from api response. When Running code_issues_list_command function. Then The api is called in the right amount of times. """ from PrismaCloudV2 import code_issues_list_command m = mocker.patch.object( prisma_cloud_v2_client, "_http_request", side_effect=[ { "data": [{"firstDetected": "some_date", "policy": "policy1", "severity": "severity1", "labels": ["label1"]}], "hasNext": True, }, { "data": [{"firstDetected": "some_date", "policy": "policy1", "severity": "severity1", "labels": ["label1"]}], "hasNext": False, }, ], ) code_issues_list_command(prisma_cloud_v2_client, {"check_status": "Passed"}) assert m.call_count == 2 limit_reached_data = [ { "data": [ { "repository": "repo1", "firstDetected": "2024-01-01", "policy": "policy1", "severity": "high", "labels": [], "repositorySource": "source1", }, { "repository": "repo2", "firstDetected": "2024-01-02", "policy": "policy2", "severity": "medium", "labels": [], "repositorySource": "source2", }, ], "hasNext": True, }, { "data": [ { "repository": "repo3", "firstDetected": "2024-01-03", "policy": "policy3", "severity": "low", "labels": [], "repositorySource": "source3", }, { "repository": "repo4", "firstDetected": "2024-01-04", "policy": "policy4", "severity": "critical", "labels": [], "repositorySource": "source4", }, ], "hasNext": False, }, ] def test_code_issues_list_command_pagination_limit_reached(mocker, prisma_cloud_v2_client): """ Given A limit. When Running code_issues_list_command function and there are more issues then the given limit. Then The number of issues returned is not more then the limit. """ from PrismaCloudV2 import code_issues_list_command mocker.patch.object(prisma_cloud_v2_client, "_http_request", side_effect=limit_reached_data) result = code_issues_list_command(prisma_cloud_v2_client, {"limit": 3, "fixable_only": True}) assert isinstance(result.outputs, list) assert len(result.outputs) == 3 # 3 results in total assert "repo1" in result.readable_output assert "repo2" in result.readable_output assert "repo3" in result.readable_output assert "repo4" not in result.readable_output # This item should not be included lower_limit_data = { "data": [ { "repository": "repo1", "firstDetected": "2024-01-01", "policy": "policy1", "severity": "high", "labels": [], "repositorySource": "source1", } ], "hasNext": False, } def test_code_issues_list_command_single_page_no_pagination(mocker, prisma_cloud_v2_client): """ Given A limit. When Running code_issues_list_command function and there are less issues then the given limit. Then The number of issues returned is exactly the number of issues that exist. """ from PrismaCloudV2 import code_issues_list_command m = mocker.patch.object(prisma_cloud_v2_client, "_http_request", return_value=lower_limit_data) result = code_issues_list_command(prisma_cloud_v2_client, {"limit": 5, "fixable_only": True}) assert isinstance(result.outputs, list) assert len(result.outputs) == 1 # Only one result returned assert "repo1" in result.readable_output assert m.call_count == 1 assert m.call_args.kwargs["json_data"]["offset"] == 0 code_issues_list_request_data = [ # Test case with some filters set and default values ( { "fixable_only": True, "branch": "main", "check_status": "open", "severities": ["high", "critical"], }, { "filters": {"branch": "main", "checkStatus": "open", "fixableOnly": True, "severities": ["high", "critical"]}, "limit": 50, "offset": 0, }, ), # Test case with search filters and different limit/offset ( {"fixable_only": True, "search_scopes": ["scope1", "scope2"], "search_term": "vulnerability", "limit": 10, "offset": 5}, { "filters": {"fixableOnly": True}, "search": {"scopes": ["scope1", "scope2"], "term": "vulnerability"}, "limit": 10, "offset": 5, }, ), # Test case with multiple filter options ( { "git_users": ["user1", "user2"], "iac_categories": ["category1"], "vulnerability_risk_factors": ["risk1", "risk2"], }, { "filters": { "gitUsers": ["user1", "user2"], "iacCategories": ["category1"], "vulnerabilityRiskFactors": ["risk1", "risk2"], }, "limit": 50, "offset": 0, }, ), ] @pytest.mark.parametrize("given_params, expected_body", code_issues_list_request_data) def test_code_issues_list_request(mocker, given_params, expected_body, prisma_cloud_v2_client): """ Given Arguments. When Running code_issues_list_request function with these arguments. Then The http request is called once with the right body. """ from PrismaCloudV2 import code_issues_list_request_body m = mocker.patch.object(prisma_cloud_v2_client, "_http_request") body = code_issues_list_request_body(**given_params) prisma_cloud_v2_client.code_issues_list_request(body) m.assert_called_once_with("POST", "/code/api/v2/code-issues/branch_scan", json_data=expected_body) user_pagination_data = [ # case `page` and `page_size` with limit arguments witch needs to be ignored ({"fixable_only": True, "page": 3, "page_size": 1, "limit": 50}, 1, 3), ({"fixable_only": True, "page": 3, "page_size": 2}, 1, 6), # case `page` and `page_size` ] @pytest.mark.parametrize("args, expected_call_count, expected_offset", user_pagination_data) def test_code_issues_list_command__user_pagination(mocker, args, expected_call_count, expected_offset, prisma_cloud_v2_client): """ Given arguments with pagination arguments. When Running code_issues_list_command function. Then The api is called only once and the offset is set correctly. """ from PrismaCloudV2 import code_issues_list_command m = mocker.patch.object( prisma_cloud_v2_client, "_http_request", side_effect=[ { "data": [ {"firstDetected": "some_date1", "policy": "policy1", "severity": "severity1", "labels": ["label1"]}, {"firstDetected": "some_date2", "policy": "policy2", "severity": "severity2", "labels": ["label2"]}, ], "hasNext": True, }, { "data": [{"firstDetected": "some_date", "policy": "policy1", "severity": "severity1", "labels": ["label1"]}], "hasNext": False, }, ], ) code_issues_list_command(prisma_cloud_v2_client, args) assert m.call_count == expected_call_count assert m.call_args.kwargs["json_data"]["offset"] == expected_offset