Custom Rules
Focus
Focus
Prisma AIRS

Custom Rules

Table of Contents

Custom Rules

Learn how to create, view, list, update, archive, and unarchive custom rules in Prisma AIRS AI Model Security.
Where Can I Use This?What Do I Need?
  • Prisma AIRS (AI Model Security)
  • Prisma AIRS AI Model Security License
Custom rules let you define your own security checks in addition to the built-in managed rules. A custom rule is a tenant-wide rule that evaluates a model scan's labels and the pass/fail results of managed rules, combined with AND/OR logic, and produces a violation message and remediation steps that you define when its condition matches.
A custom rule is defined at the tenant level and then assigned to one or more security groups, where each assignment is blocking, allowing (non-blocking), or disabled. A custom rule can only be assigned to a security group whose source type is in the rule's compatible sources.
The rule_action field controls the polarity of the check. FAIL (default) produces a violation when the condition matches. PASS produces a violation when the condition does not match.
When you create or update a custom rule, its condition is validated. A request is rejected with a 422 error if it references a managed rule that does not exist, if the condition is unsatisfiable (an AND group that can never be true), is a tautology (an OR group that is always true), or exceeds the depth or leaf-node limits.
Custom rules follow these limits:
PropertyLimit
Active custom rules per tenant100
Custom rule assignments per security group25
Condition nesting depth25 levels
Condition leaf nodes (total per rule)100

Create a Custom Rule

A Custom Model Security Rule in Prisma AIRS is a user-defined policy that establishes specific criteria and automated responses for evaluating AI model security posture. These rules enable tailored security enforcement beyond default policies by integrating various data points to determine compliance or identify violations in your environment.
The core components of a Custom Model Security Rule include rule details, conditions, and actions.
  • Rule details define the custom rule's identity and scope. This includes unique identifiers, descriptive metadata, and the AI model sources the rule evaluates.
  • Conditions are criteria that a Custom Model Security Rule evaluates against an AI model or its metadata.
  • When met, these conditions trigger the rule's defined actions, providing granular control in your network.
    • Label-based conditions evaluate specific key-value pairs (labels) associated with an AI model. This enables contextual evaluation based on organizational tagging or metadata, such as checking if an environment label is development.
    • Managed rule-based conditions incorporate outcomes from existing, predefined Prisma AIRS security rules. This enables the custom rule to leverage other security evaluations, such as checking if a Managed Rule like Organization is Blocked has a Pass outcome, supporting hierarchical rule logic in your environment.
    Actions define the specific response when all conditions of a Custom Model Security Rule are met. This includes determining the security posture and providing feedback. An action can set the rule outcome to PASS. Custom violation and remediation text can be configured to provide specific details and guidance when a rule is violated.
Custom Model Security Rules are assigned to Model Security Groups, which are logical containers dictating which rules apply to specific AI models. This facilitates organized and scalable policy enforcement in your environment. Link custom rules to one or more existing Model Security Groups to activate their evaluation.
You can create a custom rule through Strata Cloud Manager, the Python SDK, or the CLI.
Create using CLI
model-security create-custom-rule \ --name "Block unlicensed production models" \ --description "Enforce licensing on production HF models" \ --violation-message "Production models must pass the License Exists check" \ --remediation-message "Add a license to the model card" \ --rule-action FAIL \ --compatible-sources HUGGING_FACE \ --condition '{"operator":"and","conditions":[{"type":"label","key":"env","operator":"equals","value":"production"},{"type":"rule_result","rule_uuid":"12345678-1234-1234-1234-123456789012","operator":"equals","value":"FAILED"}]}'
Create using Python SDK
from model_security_client.api import ModelSecurityAPIClient from model_security_client.generated.mgmt.models.CustomRuleCreateRequestSchema import CustomRuleCreateRequestSchema client = ModelSecurityAPIClient( base_url="https://api.sase.paloaltonetworks.com/aims" ) rule = client.create_custom_rule( data=CustomRuleCreateRequestSchema( name="Block unlicensed production models", description="Enforce licensing on production HF models", compatible_sources=["HUGGING_FACE"], rule_action="FAIL", violation_message="Production models must pass the License Exists check", remediation_message="Add a license to the model card", condition={ "operator": "and", "conditions": [ {"type": "label", "key": "env", "operator": "equals", "value": "production"}, {"type": "rule_result", "rule_uuid": "12345678-1234-1234-1234-123456789012", "operator": "equals", "value": "FAILED"}, ], }, ) ) print(f"Created custom rule: {rule.uuid}")
Create using Strata Cloud Manager
This procedure guides you through creating a custom model security rule in Prisma AIRS. Custom rules enhance your AI supply chain security by defining specific conditions and actions based on your organization's compliance and risk management needs.
  1. Select Prisma AIRSAI Supply ChainConfigurationsModel Security Rules, and then New Custom Rule.
  2. Define the Rule Details:
    1. For Rule Name, enter a descriptive name.
    2. For Rule Description, enter a description of the rule.
    3. For Compatible Sources for this rule, select all compatible sources the rule applies to.
      • The compatible sources you select will determine which Model Security Group it can be assigned to. Therefore select all the sources that this rule would be compatible with.
      • You cannot change compatible sources after you create the rule.
  3. Configure the Conditions and Actions for the rules:
    1. Define one or more Label based conditions. For example, set environment equals development.
    2. Define one or more Managed Rule based conditions. For example, set Organization is Blocked equals Pass.
    3. For Action, select If the condition is true, the rule outcome is PASS, If the condition is true, the rule outcome is FAIL.
    4. For custom Violation Text, enter the message to display when the rule is violated.
    5. For custom Remediation Text, enter the remediation guidance.
  4. Assign the rule to one or more Model Security Groups by selecting them from the list.
  5. Select the Assign Rule and Finish. The custom rule is saved and applied to the selected model security groups.

View a Custom Rule

You can view a custom rule through the Python SDK or the CLI.
View using CLI
model-security get-custom-rule \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012"
View using Python SDK
rule = client.get_custom_rule( custom_rule_uuid="12345678-1234-1234-1234-123456789012" )

List Custom Rules

You can list custom rules through Strata Cloud Manager, the Python SDK, or the CLI.
List using CLI
model-security list-custom-rules \ --search-query "Block" \ --source-types HUGGING_FACE \ --is-archived false \ --sort-field created_at \ --sort-dir desc \ --limit 50 \ --skip 0
List using Python SDK
result = client.list_custom_rules( search_query="Block", source_types=["HUGGING_FACE"], is_archived=False, sort_field="created_at", sort_dir="desc", limit=50, skip=0, )
List using Strata Cloud Manager
  1. Select Prisma AIRSAI Supply ChainConfigurations.
  2. Select the Model Security Rules tab to view all custom rules.

Update a Custom Rule

You can update the name, description, condition, rule action, violation message, and remediation message of a custom rule through the Python SDK or the CLI. An archived rule cannot be updated (returns a 422 error). Unarchive it first.
Update using CLI
model-security update-custom-rule \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012" \ --name "Updated name" \ --description "Updated description" \ --rule-action FAIL \ --violation-message "Updated violation message" \ --remediation-message "Add a license to the model card" \ --condition '{"type":"label","key":"team","operator":"exists"}'
Update using Python SDK
from model_security_client.generated.mgmt.models.CustomRuleUpdateRequestSchema import CustomRuleUpdateRequestSchema rule = client.update_custom_rule( custom_rule_uuid="12345678-1234-1234-1234-123456789012", data=CustomRuleUpdateRequestSchema( name="Updated name", description="Updated description", rule_action="FAIL", violation_message="Updated violation message", remediation_message="Add a license to the model card", condition={"type": "label", "key": "team", "operator": "exists"}, ), )
Update using Strata Cloud Manager
This procedure guides you through modifying existing Model Security Rules within your Prisma AIRS AI Supply Chain configuration. It covers editing rule names and descriptions from both the main list view and the detailed rule view, demonstrating a full edit cycle in your environment.
  1. Select Prisma AIRSAI Supply ChainConfigurations and then Model Security Rules tab.
  2. Locate the custom rule you want to update and select the Edit Rule icon. The Edit Model Security Rule Overview dialog opens.
  3. Update the rule details as needed:
    • For Rule Name, enter the new name.
    • (Optional) For Description, enter the new description.
  4. Select Save Changes. The updated details appear in the rule list.

Associate Custom Rules with a Security Group

A custom rule is evaluated during a scan only after you assign it to the security group used for that scan. Each assignment has one of three states: BLOCKING, ALLOWING, or DISABLED. You can assign a custom rule to one or more security groups through the Python SDK or the CLI.
Batch assignment uses partial-success processing: each security group is processed independently, so a failure on one does not roll back the others. Check the per-item status in the response before assuming all assignments succeeded. You cannot assign an archived custom rule; unarchive it first.
Assign a Custom Rule to Security Groups using CLI
model-security batch-assign-custom-rule \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012" \ --assignments '[{"security_group_uuid":"aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa","state":"BLOCKING"},{"security_group_uuid":"bbbbbbbb-2222-2222-2222-bbbbbbbbbbbb","state":"ALLOWING"}]'
Assign a Custom Rule to Security Groups using Python SDK
from model_security_client.api import ModelSecurityAPIClient from model_security_client.generated.mgmt.models.BatchAssignCustomRuleRequestSchema import BatchAssignCustomRuleRequestSchema from model_security_client.generated.mgmt.models.CustomRuleAssignmentSchema import CustomRuleAssignmentSchema client = ModelSecurityAPIClient( base_url="https://api.sase.paloaltonetworks.com/aims" ) result = client.batch_assign_custom_rule( custom_rule_uuid="12345678-1234-1234-1234-123456789012", data=BatchAssignCustomRuleRequestSchema( assignments=[ CustomRuleAssignmentSchema( security_group_uuid="aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa", state="BLOCKING", ), CustomRuleAssignmentSchema( security_group_uuid="bbbbbbbb-2222-2222-2222-bbbbbbbbbbbb", state="ALLOWING", ), ] ), )
Assign a Custom Rule to Security Groups using Strata Cloud Manager
To change a custom rule's security group assignments at any time, select the custom rule in Strata Cloud Manager and select or deselect the compatible security groups.
You can list the security groups a custom rule is assigned to through the Python SDK or the CLI.
List the Security Groups a Custom Rule is Assigned To using CLI
model-security list-custom-rule-security-groups \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012" \ --limit 50 \ --skip 0
List the Security Groups a Custom Rule is Assigned To using Python SDK
result = client.list_custom_rule_security_groups( custom_rule_uuid="12345678-1234-1234-1234-123456789012", limit=50, skip=0, )
You can remove a custom rule assignment from a security group through the Python SDK or the CLI.
Remove a Custom Rule Assignment using CLI
model-security remove-custom-rule-assignment \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012" \ --sg-uuid "aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa"
Remove a Custom Rule Assignment using Python SDK
client.remove_custom_rule_assignment( custom_rule_uuid="12345678-1234-1234-1234-123456789012", sg_uuid="aaaaaaaa-1111-1111-1111-aaaaaaaaaaaa", )

Archive a Custom Rule

Archiving is a soft delete; the rule is retained and can be unarchived later. You can archive a custom rule through Strata Cloud Manager, the Python SDK, or the CLI.
Archive using CLI
model-security archive-custom-rule \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012"
Archive using Python SDK
client.archive_custom_rule( custom_rule_uuid="12345678-1234-1234-1234-123456789012" )
Archive using Strata Cloud Manager
  1. Select Prisma AIRSAI Supply ChainConfigurations.
  2. Locate the custom rule you want to archive from the Active rules list.
  3. Select the Archive Rule icon next to the desired rule.
  4. In the confirmation dialog, select Archive this rule.
  5. Select the Archived tab to verify the rule appears in the list.

Unarchive a Custom Rule

You can unarchive a custom rule through Strata Cloud Manager, the Python SDK, or the CLI.
Unarchive using CLI
model-security unarchive-custom-rule \ --custom-rule-uuid "12345678-1234-1234-1234-123456789012"
Unarchive using Python SDK
client.unarchive_custom_rule( custom_rule_uuid="12345678-1234-1234-1234-123456789012" )
Unarchive using Strata Cloud Manager
  1. Select Prisma AIRSAI Supply ChainConfigurations.
  2. Select the Archived tab to view archived custom rules.
  3. Locate the custom rule you want to unarchive.
  4. Select the Unarchive Rule icon next to the rule. The selected rule will be successfully restored.
  5. Select the Active tab to verify the rule appears in the list.