Rule ordering and pattern matching
Table of Contents
Expand all | Collapse all
-
- Getting started
- System Requirements
- Cluster Context
-
- Prisma Cloud Container Images
- Kubernetes
- Deploy the Prisma Cloud Console on Amazon ECS
- Console on Fargate
- Onebox
- Alibaba Cloud Container Service for Kubernetes (ACK)
- Azure Container Service (ACS) with Kubernetes
- Azure Kubernetes Service (AKS)
- Amazon Elastic Kubernetes Service (EKS)
- IBM Kubernetes Service (IKS)
- OpenShift v4
-
- Defender Types
- Manage your Defenders
- Redeploy Defenders
- Uninstall Defenders
-
- Deploy Orchestrator Defenders on Amazon ECS
- Automatically Install Container Defender in a Cluster
- Deploy Prisma Cloud Defender from the GCP Marketplace
- Deploy Defenders as DaemonSets
- VMware Tanzu Application Service (TAS) Defender
- Deploy Defender on Google Kubernetes Engine (GKE)
- Google Kubernetes Engine (GKE) Autopilot
- Deploy Defender on OpenShift v4
-
- Agentless Scanning Modes
-
- Onboard AWS Accounts for Agentless Scanning
- Onboard Azure Accounts for Agentless Scanning
- Configure Agentless Scanning for Azure
- Onboard GCP Accounts for Agentless Scanning
- Configure Agentless Scanning for GCP
- Onboard Oracle Cloud Infrastructure (OCI) Accounts for Agentless Scanning
- Configure Agentless Scanning for Oracle Cloud Infrastructure (OCI)
- Agentless Scanning Results
-
- Rule ordering and pattern matching
- Backup and Restore
- Custom feeds
- Configuring Prisma Cloud proxy settings
- Prisma Cloud Compute certificates
- Configure scanning
- User certificate validity period
- Enable HTTP access to Console
- Set different paths for Defender and Console (with DaemonSets)
- Authenticate to Console with Certificates
- Configure custom certs from a predefined directory
- Customize terminal output
- Collections
- Tags
- Logon settings
- Reconfigure Prisma Cloud
- Subject Alternative Names
- WildFire Settings
- Log Scrubbing
- Clustered-DB
- Permissions by feature
-
- Logging into Prisma Cloud
- Integrating with an IdP
- Integrate with Active Directory
- Integrate with OpenLDAP
- Integrate Prisma Cloud with Open ID Connect
- Integrate with Okta via SAML 2.0 federation
- Integrate Google G Suite via SAML 2.0 federation
- Integrate with Azure Active Directory via SAML 2.0 federation
- Integrate with PingFederate via SAML 2.0 federation
- Integrate with Windows Server 2016 & 2012r2 Active Directory Federation Services (ADFS) via SAML 2.0 federation
- Integrate Prisma Cloud with GitHub
- Integrate Prisma Cloud with OpenShift
- Non-default UPN suffixes
- Compute user roles
- Assign roles
-
- Prisma Cloud Vulnerability Feed
- Scanning Procedure
- Vulnerability Management Policies
- Vulnerability Scan Reports
- Scan Images for Custom Vulnerabilities
- Base images
- Vulnerability Explorer
- CVSS scoring
- CVE Viewer
-
- Configure Registry Scans
- Scan Images in Alibaba Cloud Container Registry
- Scan Images in Amazon Elastic Container Registry (ECR)
- Scan images in Azure Container Registry (ACR)
- Scan Images in Docker Registry v2 (including Docker Hub)
- Scan Images in GitLab Container Registry
- Scan images in Google Artifact Registry
- Scan Images in Google Container Registry (GCR)
- Scan Images in Harbor Registry
- Scan Images in IBM Cloud Container Registry
- Scan Images in JFrog Artifactory Docker Registry
- Scan Images in Sonatype Nexus Registry
- Scan images in OpenShift integrated Docker registry
- Scan Images in CoreOS Quay Registry
- Trigger Registry Scans with Webhooks
- Configure VM image scanning
- Configure code repository scanning
- Malware scanning
- Windows container image scanning
- Serverless Functions Scanning
- VMware Tanzu Blobstore Scanning
- Scan App-Embedded workloads
- Troubleshoot Vulnerability Detection
-
- Compliance Explorer
- Enforce compliance checks
- CIS Benchmarks
- Prisma Cloud Labs compliance checks
- Serverless functions compliance checks
- Windows compliance checks
- DISA STIG compliance checks
- Custom compliance checks
- Trusted images
- Host scanning
- VM image scanning
- App-Embedded scanning
- Detect secrets
- OSS license management
-
- Alert Mechanism
- AWS Security Hub
- Cortex XDR alerts
- Cortex XSOAR alerts
- Email alerts
- Google Cloud Pub/Sub
- Google Cloud Security Command Center
- IBM Cloud Security Advisor
- JIRA Alerts
- PagerDuty alerts
- ServiceNow alerts for Security Incident Response
- ServiceNow alerts for Vulnerability Response
- Slack Alerts
- Splunk Alerts
- Webhook alerts
- API
Rule ordering and pattern matching
Pattern matching
All rules have resource filters that let you precisely target specific parts of your environment.
This is known as a rule’s scope.
Scope is specified using collections.
Rules reference collections to set their scope.

The fields in a collection let you capture a segment of the resources in your environment based on container name, image name, host name, etc.
By default, each field is populated with a wildcard.
Wildcards capture all objects of a given type.
Constrain the scope of a collection by specifying filters in one or more field.
You can customize how a field is evaluated with string matching.
When Prisma Cloud encounters a wildcard in a resource name, it evaluates the resource name according to the position of the wildcard.
- If the string starts with a wildcard, it’s evaluated as string-ends-with.
- If the string terminates with a wildcard, it’s evaluated as string-starts-with.
- If a string is starts and terminates with a wildcard, it’s evaluated as string-contains.
For example, if you specify a resource filter of *foo-resource*, Prisma Cloud matches that resource to any value that contains the string, such as example-foo-resource and foo-resource-1.
Matching logic is case insensitive.

Individual fields are combined using
AND
logic.
In the following example, there are filters for hosts named foo-hosts* and images named foo-images*.
There are no filters for containers or labels (they’re wildcards).
If this collection were used to scope a rule, the effective result would be to apply this rule anytime the host name starts with foo-hosts and image name starts with foo-images, regardless of the container name or label
.
If strings have no wildcards, Prisma Cloud exactly matches the value you enter against the resource string.
This gives you precise control over which values match.
For example:
- If you want to explicitly target just ubuntu:latest from Docker Hub, use docker.io/library/ubuntu:latest. Because the value you provide is the complete name of the resource, Prisma Cloud matches it exactly.

For DNS filtering, Prisma Cloud doesn’t prevent you from entering multiple wildcards per string, but it’s treated the same as if you simply entered the right-most wildcard.
The following patterns are equivalent:
*.*.b.a == *.b.a
Exemptions
While basic string matching makes it easy to manage rules for most scenarios, you sometimes need more sophisticated logic.
Prisma Cloud lets you exempt objects from a rule with the minus (-) sign (the NOT operator).
From example, if you want a rule to apply to all hosts starting with foo-hosts*, except those starting with foo-hosts-exempt*, then you could create the following rule:

When Prisma Cloud evaluates an object against a rule with a NOT operator, it first skips any object for which there is a match with the exempted object.
So, from our example:
- If the host name starts with foo-hosts-exempt, skip the rule.
- If the host name starts with foo-hosts AND the image name starts with foo-images, apply the rule.
All scope fields, in both policy rules and collection specs, support the NOT operator.
When using the NOT operator, remember that what’s being excluded can’t be broader than what’s included.
For example, the following expression for scoping images is illogical:
-ngnix*, ngnix:latest
The following expression, however, is valid.
It sets the scope to all NGINX images, and then excludes nginx:latest from the set.
ngnix*, -ngnix:latest
To exclude just a single image from the universe, set the include scope with a wildcard, and then use the NOT operator to omit the image.
*, -mongo:latest
Rule ordering

The entire set of rules in a given feature area is called the policy.
The rules in the policy are evaluated from top to bottom, making it easy to understand how policy is applied.
When evaluating whether to apply a rule to a given object, Prisma Cloud uses the following logic:
- Does rule 1 apply to object? If yes, apply action(s) defined in rule and stop. If no, go to 2.
- Does rule 2 apply to object? If yes, apply action(s) defined in rule and stop. If no, go to 3.
- …
- Apply the built-in Default rule (unless it was removed or modified).
Prisma Cloud evaluates the rule list from top to bottom until it finds a match based on the object filters.
When a match is found, it applies the actions in the rule and stops processing further rules.
If no match is found, then no action is applied.
Sometimes this could mean that an attempted action is blocked (e.g. if no access control rule is matched that allows a user to run a container).
To reorder rules, click on a rule’s hamburger button and drag it to a new position in the list.

Disabling rules
If you want to test how the system behaves without a particular rule, you can temporarily disable it.
Disabling a rule gives you a way to preserve the rule and its configuration, but take it out of service, so that it’s ignored when Prisma Cloud evaluates events against your policy.
To disable a rule, click
Actions > Disable
.
Image names
The canonical name of an image is it’s
full name
in a format like registry/repo/image-name.
For example: 1234.dkr.ecr.us-east-1.amazonaws.com/morello:foo-images.
Within Docker itself, these canonical names can be seen by inspecting any given image, like this:$ sudo docker inspect morello/foo-images | grep Repo -A 3 "RepoTags": [ "1234.dkr.ecr.us-east-1.amazonaws.com/morello:foo-images",
However, there’s a special case to be aware of with images sourced from Docker Hub.
For those images, the Docker Engine and client do not show the full path in the canonical name; instead it only shows the ‘short name’ that can be used with Docker Hub and the full name is implied.
For example, compare the previous example of an image on AWS ECR, with this image on Docker Hub:
$ sudo docker inspect morello/docker-whale | grep Repo -A 3 "RepoTags": [ "morello/docker-whale:latest",
Note that when the image is from Hub, the canonical name is listed as just the short name (the same name you could use with the Docker client to issue a command like ‘docker run morello/docker-whale’).
For images like this, Prisma Cloud automatically prepends the actual address of the Docker Hub registry (docker.io) and, if necessary, the library repo name as well, even though these values are not shown by Docker itself.
For example, you can run the Alpine image from Docker Hub simply by issuing a Docker client command like ‘docker run -ti alpine /bin/sh’.
The Docker client automatically knows that this means to pull and run the image that has a canonical name of docker.io/library/alpine:latest.
However, this full canonical name is not exposed by the Docker client when inspecting the image:
$ sudo docker inspect alpine | grep Repo -A 2 "RepoTags": [ "alpine:latest" ], "RepoDigests": [ "alpine@sha256:1354db23ff5478120c980eca1611a51c9f2b88b61f24283ee8200bf9a54f2e5c" ],
But because Prisma Cloud automatically prepends the proper values to compose the canonical name, a rule like this blocks images from Hub from running:

$ docker -H :9998 --tls run -ti alpine /bin/sh docker: Error response from daemon: [Prisma Cloud] The command container_create denied for user admin by rule Deny - deny all docker.io images.