> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/artifact-registry/3.0/dependency-firewall/configure-policy-sets.md).

# Configure policy sets

Create a Harness Dependency Firewall policy set, add policies to it, and configure the fail action, evaluation event, and scope that govern enforcement.

A policy set groups one or more Dependency Firewall policies and assigns a fail action to each. Harness evaluates every enforced policy set in scope when an artifact is fetched through an upstream proxy for the first time.

## Before you begin

* Your user account holds Account Admin, Organization Admin, Project Admin, or a custom role with permission to manage policy sets in Harness Governance.
* At least one policy with entity type **Upstream Proxy** exists in your Policy Library. To use a built-in template, go to [Built-in policy templates](https://developer.harness.io/artifact-registry/3.0/dependency-firewall/built-in-policy-templates.md). You can also write a custom policy in Rego.
* Policies are written in Rego, the policy language from Open Policy Agent (OPA). If you are new to Rego, go to the free [OPA Policy Authoring course](https://www.openpolicyagent.org/docs/latest/policy-language/).

## Create a policy set

1. Go to **Account Settings > Policies**.
2. Follow the standard process for [creating a policy set](https://developer.harness.io/harness-platform/use-harness-platform/governance/policy-as-code/harness-governance-quickstart#step-3-create-a-policy-set) (Classic documentation) in Harness. When creating the policy set:
   * Set **Entity Type** to **Upstream Proxy**.
   * Set **On what event should the policy set be evaluated** to **On Evaluation**.
   * Select the scope where the policy set applies: Account, Organization, or Project.
3. Select **Add Policy**.
4. Select the Dependency Firewall policies you want to include in this set.
5. Save the policy set.

## Configure fail actions

On the **Policy evaluation criteria** step, set a fail action for each policy in the set. This is what Dependency Firewall uses at pull time to decide the artifact verdict:

* **Error and exit**: if this policy fails, the artifact verdict is **Blocked**. The artifact is not cached in the upstream proxy and cannot be used until an exception is approved.
* **Warn & continue**: if this policy fails, the artifact verdict is **Warning**. By default the artifact is still cached and usable; the violation appears on the Dependency Firewall Violations tab. If the upstream proxy has quarantine on warn enabled, the artifact is quarantined instead and also requires an exception.

You can mix fail actions across policies in the same set. For example, set vulnerability policies to **Error and exit** for hard enforcement, and set license or package age policies to **Warn & continue** for visibility only.

## Enable enforcement

A policy set has no effect until it is enforced.

1. Go to the **Policy Sets** list.
2. Find the Dependency Firewall policy set you created.
3. Set the **Enforced** toggle to ON.

When enforced, the policy set automatically applies to every upstream proxy registry with Dependency Firewall enabled, within the policy set's scope:

* **Account** scope applies to every upstream proxy registry in the account.
* **Organization** scope applies to every upstream proxy registry in that organization.
* **Project** scope applies only to upstream proxy registries in that specific project.

{% hint style="info" %}
A policy set only evaluates artifacts on upstream proxy registries that have Dependency Firewall enabled. If a policy set is enforced but you see no violations, confirm that Dependency Firewall is enabled for the upstream proxy registry.
{% endhint %}

## Next steps

* [Built-in policy templates](https://developer.harness.io/artifact-registry/3.0/dependency-firewall/built-in-policy-templates.md) for detection methodology and recommended fail actions for each template.
* [View and triage violations](https://developer.harness.io/artifact-registry/3.0/dependency-firewall/view-and-triage-violations.md) to review the verdicts your policy sets produce.
* [Dependency Firewall overview](https://developer.harness.io/artifact-registry/3.0/dependency-firewall/overview.md) to understand the full feature set.

{% @harness-feedback/feedback %}
