> 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/harness-platform/use-harness-platform/references/network-and-security/egress-controls.md).

# Egress Controls for Harness Cloud

Restrict outbound HTTP and HTTPS traffic from Harness Cloud hosted build VMs.

{% hint style="info" %}
**Note**

Egress Control requires enablement by Harness.
{% endhint %}

## Egress Controls

Harness Cloud Egress Control enables organizations to manage and restrict outbound HTTP and HTTPS traffic from Harness Cloud. Security and platform teams can define policies that allow access to approved external destinations while blocking unauthorized resources. Egress Control is powered by Harness Runtime Protection Agent, which is also referenced as Traceable API Protection. Egress Control is supported only on Linux and Windows Harness Cloud.

***

### What you will learn from this topic

* **Restrict outbound access:** Control which external services, artifact registries, package repositories, and APIs your builds can access.
* **Define granular access policies:** Allow or block requests based on destination URLs, including specific domains and path level filtering.
* **Improve network visibility:** Monitor outbound HTTP and HTTPS requests that originate from Hosted Build VMs for security and audit purposes.
* **Centralize policy management:** Configure and maintain egress policies in the Harness console, with consistent enforcement across Harness Cloud in your account.

***

### How Egress Control works

When Egress Control is enabled for your Harness account, outbound HTTP and HTTPS requests from supported Harness Cloud Hosted Build VMs are routed through a managed proxy.

The proxy evaluates requests against your configured policies and determines whether to allow or block access to the requested destination.

Egress Control supports the following policy behavior:

* **URL-based filtering:** Configure rules using exact URL matches or substring matches with the **Contains** operator. You can target an entire destination or narrow access to specific URL paths.
* **Path-level filtering:** Restrict access to specific URL paths on an approved destination. For example, allow one repository path on an artifact registry and block the rest of that host.
* **Allow and block rules:** Explicitly allow trusted destinations and block unauthorized resources.
* **Allow-rule precedence:** Allow rules take priority over block rules. This enables a default-deny approach in which approved destinations remain accessible while other requests are blocked.
* **Automatic enforcement:** Policies apply to outbound HTTP and HTTPS requests from supported Hosted Build VMs. You do not change individual pipeline configurations.
* **Harness service connectivity:** Traffic to Harness-owned endpoints remains allowed and is not affected by your egress policies.

Manage Egress Control policies from **Application and API Runtime Protection** > **Policies** > **Custom Policies** in the Harness console.

{% hint style="warning" %}
**Important**

Egress Control policies apply at the account level. All supported Harness Cloud Hosted Builds within the account share the same policy configuration. Project-specific and pipeline-specific policies are not currently supported.
{% endhint %}

***

### Before you begin

Before you configure Egress Control, ensure you have the following:

* **Egress Control enablement:** Contact your Harness account team to request Egress Control for your account. Harness completes the required account-level provisioning and configuration.
* **AppSec Admin role:** Users who configure and manage egress policies must have the **AppSec Admin** role. This role also provides the permissions needed for the initial integration credential setup.

***

### Configure Egress Control

{% stepper %}
{% step %}

#### Request Egress Control enablement

Contact your Harness account team to request Egress Control for your Harness Cloud account.

The Harness team verifies your account configuration, provisions the required Traceable integration, and coordinates the initial enablement.
{% endstep %}

{% step %}

#### Assign the AppSec Admin role

To enable authorized users to configure Egress Control policies:

1. In the Harness console, navigate to **Roles**.
2. Select **AppSec Admin**.
3. Assign the role to the users responsible for managing egress policies.
4. Notify your Harness account team after you complete the role assignment.

Harness coordinates the required integration credentials and backend configuration. You do not need to manually configure these credentials in your Continuous Integration (CI) or Infrastructure as Code Management (IaCM) pipelines.
{% endstep %}

{% step %}

#### Create allow rules for approved destinations

Before you create restrictive policies, identify the external destinations your Harness Cloud need to access. These destinations can include artifact registries, package repositories, source control services, and external APIs.

To create an allow rule:

1. In the Harness console, navigate to **Application and API Runtime Protection** > **Policies** > **Custom Policies**.
2. Click **Add Rule**.
3. Enter a descriptive rule name, such as `allow-artifactory`.
4. Set the action to **Allow indefinitely**.
5. In the payload configuration, select the following:
   * **Field:** Request > URL
   * **Operator:** Contains
   * **Value:** `artifactory.example.com`
6. Review and submit the rule.

Repeat these steps for each approved destination.

You can also configure more granular policies with URL paths. For example, instead of allowing every resource on an artifact repository, you can restrict access to specific repository paths.
{% endstep %}

{% step %}

#### Review outbound traffic

Before you enable a default-deny policy, review the outbound HTTP and HTTPS traffic.

With your initial allow rules configured and no block-all rule in place, requests can continue to reach destinations that are not explicitly allowed.

Use the traffic visibility provided by Traceable to identify additional destinations accessed during build execution.

Pay particular attention to dependencies that might not be immediately obvious, such as:

* Package managers that download dependencies.
* CI plugins and third-party actions that contact external services.
* Build scripts that access APIs or external repositories.
* Container tooling that accesses registries.

Update your allow rules to include any additional trusted destinations.
{% endstep %}

{% step %}

#### Configure a default-deny policy

After you identify and allow the destinations required by Harness Cloud, create a block-all rule to deny requests that do not match an allow rule.

1. Navigate to **Application and API Runtime Protection** > **Policies** > **Custom Policies**.
2. Click **Add Rule**.
3. Enter a rule name, such as `block-all-default`.
4. Set the action to **Block indefinitely**.
5. In the payload configuration, select the following:
   * **Field:** Request > URL
   * **Operator:** Matches pattern
   * **Value:** `.*`
6. Review and submit the rule.

The `.*` expression matches all URLs.

Because allow rules take priority over block rules, requests that match your configured allow rules remain permitted. All other HTTP and HTTPS requests subject to Egress Control are blocked. Activating this rule can affect running or subsequent builds that depend on destinations not included in your allow rules. Validate your policies before you enable the block-all rule, and monitor for unexpected failures after activation.
{% endstep %}

{% step %}

#### Validate Egress Control

Validate that your configured policies allow trusted destinations and block unauthorized access.

To validate your configuration:

1. Create a test pipeline that uses a Linux or Windows Harness Cloud.
2. Add a **Run** step that makes an HTTP or HTTPS request to an approved destination.
3. Add another request to a destination that is not included in your allow rules.
4. Run the pipeline after you activate your default-deny policy.
5. Verify the following:
   * Requests to approved destinations succeed.
   * Requests to unauthorized destinations are blocked.
6. Review the observed outbound traffic and update your allow rules if necessary.

Repeat this validation for commonly used build dependencies and third-party services.
{% endstep %}
{% endstepper %}

***
