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

# Policies

<Warning>
  Policy filters only work for conda repositories.
</Warning>

A policy is a security control you can apply to a channel or mirror to restrict the packages users can source from them. Enforcing policies ensures that only approved software is available, helping maintain consistency across team environments and reducing security risks. Policies allow you to filter packages based on criteria such as package name, platform architecture, license, and [Common Vulnerabilities and Exposures (CVE)](./cve) score and status to meet your organization’s compliance and security requirements.

## Creating a policy

<Note>
  Creating and applying policies is restricted to users whose [role](./keycloak_config/permissions#permission-levels) provides `Manage` permissions for the **Policy Engine** category.
</Note>

1. Log in to Package Security Manager.
2. Select <Icon icon="filter" iconType="light" /> **Policies** from the left-hand navigation.
3. Click **Create policy**.
4. Complete the [Create policy form](#create-policy-form).
5. Click **Create Policy**.

### Create policy form

The **Create policy** form provides a step-by-step approach to building policies for your channels and mirrors. Let’s take a look at the different sections of the **Create policy** form and what configurations they control:

<Tip>
  * Each section of the form provides a tip to help you understand and complete the process.
  * As you build the policy, a real-time summary appears on the right, explaining in plain language what the policy enforces.
  * Click **Previous** or **Next** to navigate the different sections of the **Create policy** form.
</Tip>

<Steps>
  <Step title="Set Details">
    <Frame>
      <img src="https://mintcdn.com/anaconda-29683c67/EGEany5B9-e-xQwO/images/set_policy_details.png?fit=max&auto=format&n=EGEany5B9-e-xQwO&q=85&s=dc4c05a828ba7d1d49001ede6fe4e7de" alt="" width="1922" height="934" data-path="images/set_policy_details.png" />
    </Frame>

    1. **Policy Name**\
       Provide a unique name for your policy. Anaconda recommends using a descriptive name that helps users understand its purpose.
    2. **Description**\
       Enter a brief description of what effect the policy will have on a channel or mirror.
  </Step>

  <Step title="Set Package Rules">
    <Frame>
      <img src="https://mintcdn.com/anaconda-29683c67/EGEany5B9-e-xQwO/images/set_policy_package_rules.png?fit=max&auto=format&n=EGEany5B9-e-xQwO&q=85&s=2b91ac3c320ed4132be8a3fdd6037c23" alt="" width="1922" height="945" data-path="images/set_policy_package_rules.png" />
    </Frame>

    1. **Platform**\
       Restrict packages based on their platform architecture.
           <Note>
             Package Security Manager automatically includes any `noarch` package dependencies in your channel when you apply a policy that restricts packages by platform architecture.
           </Note>
    2. **License**\
       Restrict packages based on their license type. Multiple license types can be specified for the policy. For more information on licenses, see [License types](/docs/psm-on-prem/6.7.2/reference/licensetypes).
    3. **Package Name(s)**\
       If you know the specific packages you want your channel or mirror to contain, enter their names here.
           <Warning>
             Specifying packages by name does not automatically populate the channel with their dependencies.
           </Warning>
    4. **Include Dependencies**\
       Select this checkbox to include dependencies for the packages specified in the **Package Name(s)** field.
    5. **Other Package Criteria**

       * **Only Signed Packages**\
         Select this checkbox to only mirror packages that have Anaconda signatures from the source mirror.
       * **Legacy Packages**\
         Select this checkbox to include `.tar.bz2` package files along with `.conda` files for packages. *This effectively doubles your required storage space*.

           <Note>
             When left unselected, if `.tar.bz2` files are the only ones available in the source, they are included.
           </Note>
    6. **Date Range**\
       Instruct the policy to only include packages that were created within the range selected.
  </Step>

  <Step title="Set CVE Rules">
    <Frame>
      <img src="https://mintcdn.com/anaconda-29683c67/EGEany5B9-e-xQwO/images/set_policy_cve_rules.png?fit=max&auto=format&n=EGEany5B9-e-xQwO&q=85&s=11c3be24fba0828689ea71956b8364dc" alt="" width="1922" height="946" data-path="images/set_policy_cve_rules.png" />
    </Frame>

    1. **CVE Score**\
       Restrict packages based on their associated [CVE Scores](./cve#cve-scores).
    2. **and/or**
       * The *and* operator includes package files that meet *all* the specified criteria.
       * The *or* operator includes package files that meet *at least one* of the specified criteria.
    3. **CVE Status**\
       Restrict packages based on their associated [CVE Status](./cve#cve-statuses).
    4. **CVE Allowlist IDs**\
       CVEs listed here are not considered for package file filtering criteria.
  </Step>

  <Step title="Set Exclusions">
    <Frame>
      <img src="https://mintcdn.com/anaconda-29683c67/EGEany5B9-e-xQwO/images/set_policy_exclusions_exceptions.png?fit=max&auto=format&n=EGEany5B9-e-xQwO&q=85&s=6b4fa3b40ed7574a13e9356053eef627" alt="" width="3458" height="1896" data-path="images/set_policy_exclusions_exceptions.png" />
    </Frame>

    1. **Exclude Packages**\
       Enter the name of any packages you want to exclude. To list multiple packages, press the Tab key after entering each package name.
    2. **Exclusion Exceptions**\
       Include specific packages that would otherwise be removed by the exclude packages filter by listing them here.
    3. **CVE Status**\
       Choose to restrict packages by [CVE Status](./cve#cve-statuses).

           <Note>
             Packages can be excluded and included against non-exact values by including wildcard `*` and `>/<` ranges (where supported).\
             For example, if you choose to exclude the package `p*`, Package Security Manager excludes all packages that start with the letter “p”. For more information about using non-exact value search queries, see [Package Match Specifications](https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/pkg-specs.html#package-match-specifications) in the official conda documentation.
           </Note>
  </Step>

  <Step title="Review">
    Review the rules that your policy will enforce.

    <Frame>
      <img src="https://mintcdn.com/anaconda-29683c67/GAawxvWy-HUVSCqf/images/policy_review.png?fit=max&auto=format&n=GAawxvWy-HUVSCqf&q=85&s=ecc478ea1cab003b0ffd4e5dcf77ad2f" alt="" width="3460" height="1900" data-path="images/policy_review.png" />
    </Frame>
  </Step>
</Steps>

## Managing policies

Select <Icon icon="filter" iconType="light" /> **Policies** from the left-hand navigation to view all policies and which channels and mirrors they are associated with.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/9H-5W4tTlP7-Fn32/images/as_view_policies.png?fit=max&auto=format&n=9H-5W4tTlP7-Fn32&q=85&s=eecd492774746a3f77c051a7b450d32b" alt="" width="1922" height="815" data-path="images/as_view_policies.png" />
</Frame>

<Tip>
  Use the search box to locate a policy by name.
</Tip>

### Policy actions

Use the icons in the **Actions** column to manage your policies. You can view, edit, or delete your organization’s policies, as well as search for specific policies and see their assigned channels and descriptions.

<Frame>
  <img src="https://mintcdn.com/anaconda-29683c67/GAawxvWy-HUVSCqf/images/policy_actions.png?fit=max&auto=format&n=GAawxvWy-HUVSCqf&q=85&s=860d778bb7e3c26f6260f0f985f3ad08" alt="" width="1922" height="815" data-path="images/policy_actions.png" />
</Frame>
