> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiddenlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Supply Chain Policy

The Supply Chain policy defines how scan results are classified as **Compliant** or **Noncompliant**. That status appears in the Asset Scans table on the **Supply Chain > Asset Scans** page.

## Important Notes about Supply Chain Policy

* One Supply Chain policy applies to every scan in a HiddenLayer tenant. Runtime policy, by contrast, can differ by project.

* By default, models with any detection are **Noncompliant**.

* In the Console, add policy rules to choose which severity levels, detection categories, and file types count as **Noncompliant**.

  * Supply Chain policy rules are prioritized by their order. A rule closer to the top of the list overrides the rules below it when two rules collide.

* Through the API you can set compliance for combinations of severity, category, and file type.

* A new policy applies to scans that run after you save; existing scan rows are not rescanned or rewritten automatically.

## Update the policy in the Console

In the Console, you can create policy rules to meet your policy criteria.

1. In the Console, select **Supply Chain > Policy** in the side navigation. The Supply Chain Policy page displays.
2. Click **Edit**.

![Edit a Supply Chain policy](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-edit.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=f20a2c49238ea9c22aa7c0214736bf6c)

3. Click **+ Add Rule** to open the Add Rule window and view the Rule Builder.

   * The image below shows the default policy; this means no rules have been added yet.
   * If rules have already been added to the policy and you want to add a rule, the **+ Add Rule** button is on the right side of the **MANAGED RULES** row.

![Add a Rule to a Supply Chain policy](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-add-rule.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=b3f583f8bfec7876f8779ec2dc7129ee)

4. Use the **Rule Builder** or select a **Rule Template**.

   * The rule builder allows you to select an attribute, select values for that attribute, and add an operator to add more attributes and values to the Rule Builder.
   * The rule templates allows you to choose a rule from the HiddenLayer Supply Chain standard rule set.

![Add a Rule to a Supply Chain policy](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-create-rule.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=13a5e7390a50f6073ac05f9a4cebc2b6)

5. To use the **Rule Builder**:

   * Enter a name for the rule and add any notes to provide context for whoever edits this rule in the future.

   * Select **Compliant** or **Noncompliant** for the rule. **Noncompliant** is selected by default.

     * When a model file is scanned, if a scan result matches the rule criteria, then the model file will be marked as compliant or noncompliant, based on the rule.

   * For the Rule Builder, click the green plus sign, then select an **Attribute**.

     ![Add an attribute to the rule builder](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-rule-builder-select-attribute.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=0c92e8762de989307c6260b8bd57aa94)

   * After selecting an attribute, a list of values displays.
     * Select the values for the attribute, then click **Add**.
     * You can select multiple values for one attribute.

       ![Add values to the rule builder](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-rule-builder-select-values.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=475f16b7fe4e6eedc838b0f0d1b487aa)

   * To add another attribute, click the green plus sign, then select an operator (**and** or **not**).

     * After selecting an operator, select the attribute, then select the values.

       ![Add an operator to the rule builder](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-rule-builder-add-operator.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=dc9a86d48b70ba434095d83215558cef)

   * When you are done with the rule builder, click **Add Rule**.

6. To use a **Rule Template**:

   * Select a rule template, then click **Add Rule**.

![Add a Rule to a Supply Chain policy](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-select-template.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=68d13921078161d9c7d875285dbe342b)

7. To change the priority for a rule, drag the rule to the position you want.

   * You can drag the rule to be the first, the last, or somewhere in between.
   * You can only drag rules within the managed rules section. The system rules are always at the bottom and are overridden by any managed rules.

8. When you are done adding rules to the policy, click **Preview changes**.

   * This takes you to the Policy Preview page. You can see what the current policy is and what the edited policy will change.
   * If you need to make changes, click **Cancel** and you will go back to the rules page.

     * Make you changes, then click **Preview changes** when you are ready.

9. Click **Save Changes** to save the policy.

### Enable and Disable Rules

You can enable and disable rules within a policy to adjust the policy as needed, without deleting any rules. An example of when to enable and disable rules is when you are testing policy adjustments and may need to enable a policy rule.

1. In the Console, select **Supply Chain > Policy**.

2. Click **Edit**.

3. For the rule you want to enable or disable, click the toggle.

   ![Enable or disable rules using the rule toggle](https://mintcdn.com/hiddenlayer/FV9zKI9xd0AYnJIX/docs/products/supply-chain/console/images/supplychain-console-policy-enable-disable-rules.png?fit=max\&auto=format\&n=FV9zKI9xd0AYnJIX\&q=85\&s=8c308e8c52f17ffbadbbaa27625b970c)

4. When you are done making adjustments, click **Preview changes**.

   * This takes you to the Policy Preview page. You can see what the current policy is and what the edited policy will change.
   * If you need to make changes, click **Cancel** and you will go back to the rules page.

     * Make you changes, then click **Preview changes** when you are ready.

5. Click **Save Changes** to save the policy.

### Reset Policy to Default

You can reset the Supply Chain policy back to its default settings. This removes all managed rules but leaves the system rules. System rules are always on and cannot be edited.

> [!NOTE]
>
> Before you set the policy back to default, consider [enabling and disabling managed rules](#enable-and-disable-rules) within the policy.

1. In the Console, select **Supply Chain > Policy**.
2. Click **Reset Policy to Default**. A confirmation message displays.
3. Click **Reset Policy to Default** to confirm the action.

### Rule Builder Attributes

| Attribute | Description |
| - | - |
| not | Can be used for exclusion or logic inversion. |
| Threat Level | The severity level of the scan. Values include: None, Low, Medium, High, and Critical. |
| Detection Category | Supply Chain defines attacks by technique. See [Detection Categories](https://docs.hiddenlayer.ai/docs/products/supply-chain/console/supply_chain_severity_levels.md) for more details. |
| File Type | The file type scanned. See [Supported File Types](https://docs.hiddenlayer.ai/docs/products/supply-chain/cli/supported_model_formats.md) for a list of supported file types. |
| Trust Level | The trust level for the model file. |
| Country of Origin | The geographic region where the model was first posted. This enables customers to exclude models based on origin. |
| License | The software license tied to the model. |

## Advanced Supply Chain Policy via API

Using the HiddenLayer API, you can create a complex policy with multiple rules that factor file attributes detected from a scan. Policies can be based on Severity, File Type, Categories, License, and Country of Origin.

### How it works

1. **Baseline:** Any file with a detection is **Noncompliant**; files with no detections are **Compliant**.
2. **Rules:** Each rule tests the file against its conditions. If every condition in the rule matches (**AND** only), the rule sets the compliance flag you configured. If any condition fails, that rule leaves the status unchanged.

* Conditions can use severity, detection category, and file type.

Later rules override the outcome of earlier rules, so rule order is the priority order.

**Example:** A **pickle** file scans as **Suspicious Functions** at **Medium** severity. Custom rules are applied in this order:

| Step | Rule | Resulting file status |
| - | - | - |
| 0 | Baseline: no custom rules applied. The file is Noncompliant because it has a Suspicious Functions detection. | Noncompliant |
| 1 | All pickle files are Noncompliant. | Noncompliant |
| 2 | All files with severity Medium are marked as Compliant. | Compliant |
| 3 | All files with Suspicious Functions category are Noncompliant. | Noncompliant |

The final status is **Noncompliant** because the last matching rule (step 3) prevails.

### Adding rules through the API

POST a policy with one or more rules. Each rule lists conditions (combined with **AND**) and `is_compliant_when_conditions_met`, which sets compliance when every condition matches.

> [!NOTE]
>
> **API vs Console**
>
> Creating or updating Supply Chain policy through the API turns off policy editing in the Console. You can still revert to the default policy from the Console.

### `curl` example

This `POST /governance/v1/rule-sets` request creates a policy with one rule: when the file type is **pickle** and the detection category is **not** Repository Sideloading, `is_compliant_when_conditions_met: false` marks the scan **Noncompliant**.

* Replace `<new_policy_rule>` with a display name for your policy.
* Replace `<YOUR_TOKEN_HERE>` with an access token that you get with your client ID and client secret. See [Use a Client Credential](https://docs.hiddenlayer.ai/docs/products/console/apikey_aisec_platform.md#use-a-client-credential). You can also use an API key as the bearer token. See [Use an API Key](https://docs.hiddenlayer.ai/docs/products/console/apikey_aisec_platform.md#use-an-api-key).
* Use the API host for your environment (for example `https://api.hiddenlayer.ai` or `https://api.eu.hiddenlayer.ai`).
* For `file_type` conditions, `field_value` must match the file type string shown in the scan report for that file.

```sh theme={null}
curl -i -X POST \
  'https://api.hiddenlayer.ai/governance/v1/rule-sets' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "display_name": <new_policy_rule>,
    "rules": [
      {
        "is_compliant_when_conditions_met": false,
        "conditions": [
          {
            "field": "file_type",
            "condition_operator": "equals",
            "field_value": "pickle"
          },
          {
            "field": "category",
            "condition_operator": "not_equals",
            "field_value": "Repository Sideloading"
          }
        ]
      }
    ]
  }'
```

## Policy Configurations

<table><thead><tr><th>Category </th><th>Description</th><th width="50%">Available options </th></tr></thead><tbody><tr><td>Severity</td><td>Threat level from the scan.<ul><li>Selected severities can mark a scan **Noncompliant**; unselected severities are ignored.</li><li>Default: all levels selected.</li></ul></td><td>Critical, High, Medium, Low</td></tr><tr><td>File types</td><td>The file types included in the policy.<ul><li>Selected file types will label a model scan as **Noncompliant** if any selected threat levels are identified for the selected file types.</li><li>All file types are selected by default.</li></ul></td><td>NEMO, numpy, onnx, pickle, pytorch, RDS, safetensors, skops, tensorflow, unknown, ZIP, CONFIGURATION, GIT\_CONFIGURATION, INITIALIZATION, JAVASCRIPT, MARKDOWN, PLAINTEXT, PNG, PYTHON, SHELL\_SCRIPT, YAML, and TAR</td></tr><tr><td>Categories</td><td>Detection categories included in the policy.<ul><li>Selected detection categories will label a model scan as **Noncompliant** if any selected file types have a selected threat level.</li><li>All detection categories are selected by default.</li></ul></td><td>XSS, CSRF, SSRF, Denial / Disruption of Service, Remote Code Execution, Improper Authentication, Unsecured Credential Storage, Arbitrary Code Execution, Arbitrary Read Access, Arbitrary Write Access, Arbitrary Read-Write Access, Out of Bounds Memory Read Access, Out of Bounds Memory Write Access, Network Requests, Suspicious Functions, Directory Traversal, Denial of Service, Decompression Vulnerabilities, Data Leakage Through Serialized Objects, Embedded Payloads, Fault Injection, Prompt Jailbreaking, Prompt Hijacking, Prompt Leaking, Indirect Prompt Injection, Code Injection, Excessive Agency/Permission Manipulation, Sensitive Data Leakage, Data Poisoning in Static ML, Data Poisoning in Online Learning, Data Poisoning in Federated Learning, Label Manipulation, Model Poisoning, Neural Payload, Graph Payload, Model Evasion, Training Data Extraction / PII Leakage, Model Extraction / IP Leakage, Membership Inference Attacks, Denial/Disruption of Service via Input Manipulation, Suspicious File Format, Repository Sideloading, Control Vector, and TokenBreak</td></tr></tbody></table>

## Audit log

| Countries of Origin | Countries of Origin match against the first detected instance of a published model. | Any two-letter country code from [ISO 3166-1](https://www.iso.org/obp/ui/#search/code/). |
| - | - | - |
| Licenses | Selected license values are free-form text, which often match against SPDX IDs. | Any identifier from the [SPDX License List](https://spdx.org/licenses/). |
