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

# Automated Pull Requests

> Automatically generate pull requests with dependency upgrades and security fixes in GitHub, GitLab, Azure DevOps, and Bitbucket Cloud.

Remediation PRs are pull requests that Endor Labs opens in your source code management (SCM) system to upgrade vulnerable dependencies. A remediation policy decides which upgrades qualify. Endor Labs then updates the manifest files with the recommended version and opens a PR that you review and merge.

## Supported SCM platforms

Endor Labs opens Remediation PRs for projects that you import through an Endor Labs SCM app. Projects that you scan only with endorctl in CI do not receive Remediation PRs.




&#x20; \- Platform: GitHub Cloud
&#x20; App: \[GitHub Cloud App Pro]\(/setup-deployment/scm-integrations/github-app)
&#x20; Remediation\_PRs: -yes-
&#x20; \- Platform: GitHub Enterprise Server
&#x20; App: \[GitHub Enterprise Server App]\(/setup-deployment/scm-integrations/github-app/github-enterprise-app)
&#x20; Remediation\_PRs: -yes-
&#x20; \- Platform: GitLab, including self-managed GitLab
&#x20; App: \[GitLab App]\(/setup-deployment/scm-integrations/gitlab-app)
&#x20; Remediation\_PRs: -yes-
&#x20; \- Platform: Azure DevOps Services
&#x20; App: \[Azure DevOps App]\(/setup-deployment/scm-integrations/azure-app)
&#x20; Remediation\_PRs: -yes-
&#x20; \- Platform: Bitbucket Cloud
&#x20; App: \[Bitbucket Cloud App]\(/setup-deployment/scm-integrations/bitbucket-cloud)
&#x20; Remediation\_PRs: -yes-
&#x20; \- Platform: Bitbucket Data Center
&#x20; App: \[Bitbucket Data Center App]\(/setup-deployment/scm-integrations/bitbucket-datacenter-app)
&#x20; Remediation\_PRs: -no-


&#x20;&#x20;

GitLab calls a pull request a merge request (MR). On GitLab, Endor Labs opens merge requests, and the notification activity shows them as **MR !** followed by the merge request number.

The following platform restrictions apply:

* **Azure DevOps**: Endor Labs supports Azure DevOps Services on `dev.azure.com` or `*.visualstudio.com`. It does not support Azure DevOps Server, the on-premises edition.
* **Bitbucket Cloud**: The Bitbucket Cloud App must connect with a workspace or project access token. Endor Labs doesn't open Remediation PRs when the app connects with an app password, or with an email and API token.
* **Bitbucket Cloud**: Endor Labs does not add the reviewers that you set in Endor Labs. To assign the default reviewers of your Bitbucket repository, give the access token the optional `account` scope.
* **Self-managed GitLab**: If your GitLab instance uses a self-signed certificate, mount the certificate under `/etc/ssl/certs`. See [Configure Outpost on GitLab self-hosted with self-signed certificates](https://docs.endorlabs.com/setup-deployment/outpost/outpost-configuration.md#configure-outpost-on-gitlab-self-hosted-with-self-signed-certificates) to mount it.

### Token permissions

To open Remediation PRs, Endor Labs creates a branch, commits the manifest changes, and opens the PR. It also updates the PR description, adds comments, closes the PR, and deletes the branch. The token of your SCM integration needs the following permissions.

* **GitLab**: The `api` scope.
* **Azure DevOps**: **Code (Read & Write)**.
* **Bitbucket Cloud**: `pullrequest:write` and `repository:write`. Optionally, add `account` to assign the default reviewers of your repository.

A token that you created only for scanning might not have these permissions. Update the token of your existing SCM integration before you set up Remediation PRs.

## Understanding Remediation PRs

When the next scan finds an upgrade that fixes findings and matches the remediation policy, Endor Labs creates a PR in your SCM with the details. You can merge the PR after review to fix the vulnerability findings.

Endor Labs updates the PR if there is a recommendation change in [upgrade impact analysis](https://docs.endorlabs.com/risk-remediation/upgrade-impact-analysis.md). If there are any changes in the vulnerability findings, Endor Labs updates the PR description. If there is new patch version available, Endor Labs closes the existing PR with comments and opens a new PR. If you resolve the notification in Endor Labs, Endor Labs closes the PR with a comment and deletes the PR branch.

Endor Labs closes a PR in the way each platform supports. It abandons the PR in Azure DevOps and declines the PR in Bitbucket Cloud.

Endor Labs does not further update the PR in the following scenarios, if you:

* Add a commit to the PR
* Close the PR
* Delete the PR branch
* Dismiss the notification in Endor Labs

The following diagram shows the lifecycle of a Remediation PR.


&#x20; flowchart LR
&#x20;   A\["Scan finds fixes that match\<br/>the remediation policy"] --> B\[Endor Labs creates a PR]
&#x20;   B --> C\{What changed?}
&#x20;   C -->|Upgrade impact recommendation| D\[Endor Labs updates the PR]
&#x20;   C -->|Vulnerability findings| E\[Endor Labs updates the PR description]
&#x20;   C -->|New patch version| F\["Endor Labs closes the PR with comments\<br/>and opens a new PR"]
&#x20;   C -->|Notification resolved| G\["Endor Labs closes the PR with a comment\<br/>and deletes the PR branch"]
&#x20;   B --> H\["You add a commit, close the PR,\<br/>delete the PR branch, or dismiss\<br/>the notification"]
&#x20;   H --> I\[Endor Labs stops updating the PR]
&#x20;   B --> J\[You merge the PR after review]
&#x20;   classDef endor fill:\{\{endorColor}},stroke:\{\{endorBorder}},color:#000000
&#x20;   classDef external fill:\{\{externalColor}},stroke:\{\{externalBorder}},color:#000000
&#x20;   class B,D,E,F,G endor
&#x20;   class H,I,J external
&#x20;&#x20;

## Set up Remediation PRs

Complete the following tasks to set up Remediation PRs.

1. Import your repositories with the Endor Labs app for your SCM and enable the SCA scanner. See [Supported SCM platforms](#supported-scm-platforms) for the app to use.
2. [Create a PR Remediation notification integration.](#create-a-pr-remediation-notification-integration)
3. [Create a remediation policy with the notification integration that you created in the previous step.](https://docs.endorlabs.com/platform-administration/policies/remediation-policies.md)

   The following image shows a remediation policy for projects with the tag `java`. It raises a PR for low-risk upgrades of reachable dependencies that fix critical and high findings.

   ![Remediation Policy 1](https://mintcdn.com/endorlabs-b4795f4f/7MJ99Ie5ogYX3aCL/images/risk-remediation/automated-pull-requests/auto-pr-remediation-policy.webp?fit=max\&auto=format\&n=7MJ99Ie5ogYX3aCL\&q=85\&s=9592f8f383048da2549755dcb06c0482)

### Turn off Remediation PRs for a scan profile

Remediation actions are on by default for every scan profile. To stop Remediation PRs for the projects that use a scan profile, set `ENDOR_SCAN_REMEDIATION_ACTION` to `false` under **additional\_environment\_variables** in the scan profile. See [Configure automated scan parameters](https://docs.endorlabs.com/scan/scan-profiles/build-tools.md#configure-automated-scan-parameters) to set environment variables in a scan profile.

> [!NOTE]
>
> The `enable_remediation_action` scan profile field is deprecated. Endor Labs ignores it, so setting it to `false` no longer turns off remediation actions.

## Remediation PRs support

Remediation PRs are supported for Java (with Gradle or Maven), Go (version 1.18 and higher), Python, .NET, and JavaScript.

### Remediation PRs support matrix




&#x20; \- Ecosystem: Python
&#x20; Package\_manager: pip
&#x20; Build\_files: \`pyproject.toml\`, \`requirements.txt\`
&#x20; Automated\_PR\_remediation: -yes-
&#x20; \- Ecosystem:
&#x20; Package\_manager: pip
&#x20; Build\_files: \`setup.py\`, \`setup.cfg\`
&#x20; Automated\_PR\_remediation: -no-
&#x20; \- Ecosystem:
&#x20; Package\_manager: Poetry
&#x20; Build\_files: \`pyproject.toml\`, \`poetry.lock\`
&#x20; Automated\_PR\_remediation: -no-
&#x20; \- Ecosystem:
&#x20; Package\_manager: PDM
&#x20; Build\_files: \`pyproject.toml\`, \`pdm.lock\`
&#x20; Automated\_PR\_remediation: -no-
&#x20; \- Ecosystem: Java
&#x20; Package\_manager: Maven / Gradle
&#x20; Build\_files: \`pom.xml\`, \`build.gradle\`, \`build.gradle.kts\`
&#x20; Automated\_PR\_remediation: -yes-
&#x20; \- Ecosystem: Go
&#x20; Package\_manager: Go modules
&#x20; Build\_files: \`go.mod\`, \`go.sum\`
&#x20; Automated\_PR\_remediation: -yes-
&#x20; \- Ecosystem: JavaScript
&#x20; Package\_manager: npm / yarn / pnpm
&#x20; Build\_files: \`package.json\`, \`package-lock.json\`, \`yarn.lock\`, \`pnpm-lock.yaml\`
&#x20; Automated\_PR\_remediation: -yes-
&#x20; \- Ecosystem: .NET
&#x20; Package\_manager: NuGet
&#x20; Build\_files: \`\*.csproj\`, \`packages.lock.json\`
&#x20; Automated\_PR\_remediation: -yes-


&#x20;&#x20;

### Limitations of Remediation PRs

Remediation PRs have the following limitations:

* Maven projects that use `dependencyManagement` tags and rely solely on dependency information in the parent pom file are not supported.
* Gradle projects with convention files (Groovy files with `.gradle` extension with any name) are not supported.
* Gradle projects with resource catalogues (version defined in `.toml` files) are not supported.
* Gradle projects that use Spring Framework plugins, such as the Spring Boot Gradle plugin, to manage dependency versions are not supported. These plugins handle versioning internally, so dependency versions are not explicitly declared in the Gradle manifest file.
* Go projects that use the `replace` directive in `go.mod` are not supported. `replace` directives are commonly used for local development, debugging, or patching dependencies.
* JavaScript projects using npm and Yarn workspaces are not supported.
* .NET projects that use `packages.config`, or central package management (`Directory.Packages.props`) together with a `Directory.Build.props` file, are not supported.
* Dependency names must match the case used in the manifest file.
* Updates to .NET dependencies with wildcard characters in their names are not supported.

## Create a PR Remediation notification integration

The PR Remediation notification integration lets a remediation policy open PRs. One integration works for every supported SCM platform, and Endor Labs opens each PR on the platform of the project.

1. Select **User menu** > **Integrations** from the left sidebar.

2. Under **Notifications**, click **Add** for **PR Remediation**. If the namespace already has a PR Remediation integration, click **Manage**.

   ![PR Remediation tile on the Integrations page](https://mintcdn.com/endorlabs-b4795f4f/7MJ99Ie5ogYX3aCL/images/risk-remediation/automated-pull-requests/pr-remediation-tile.webp?fit=max\&auto=format\&n=7MJ99Ie5ogYX3aCL\&q=85\&s=94f36a2bcba49c0b8a2cec822b8f1764)

3. Click **Add Notification Integration**.

4. Enter a name and description for this integration.

5. Select **Enable PR Notification Integration for Remediations**.

   Endor Labs opens Remediation PRs only when you select this option.

6. Optional: Clear **Propagate this notification target to all child namespaces** to apply the integration to this namespace only. The option is selected by default.

   ![Form to add a PR Remediation notification integration](https://mintcdn.com/endorlabs-b4795f4f/7MJ99Ie5ogYX3aCL/images/risk-remediation/automated-pull-requests/pr-remediation-notification-form.webp?fit=max\&auto=format\&n=7MJ99Ie5ogYX3aCL\&q=85\&s=94552ecb2e655523f6d52782adf696f4)

7. Click **Add Notification Integration**.

> [!NOTE]
>
> The **GitHub PR for Remediations** integration is no longer available. Use a PR Remediation integration in your remediation policies.

## View remediation PRs

Each Remediation PR contains version changes, vulnerability details, and compatibility analysis. The following steps use GitHub as an example. The PR shows the same details on the other platforms.

1. Open your repository in GitHub.

2. Select **Pull Requests** to view all the remediation PRs in the repository.

   ![GitHub Remediation PRs](https://mintcdn.com/endorlabs-b4795f4f/2CFeZIRm7eKUPEq0/images/risk-remediation/automated-pull-requests/remediation-pr.webp?fit=max\&auto=format\&n=2CFeZIRm7eKUPEq0\&q=85\&s=67f26b7e4f63bfb596ffa48173cae23f)

3. Select a PR to view its details.
   * Select **Conversation** to view the version changes, security impact, fixed vulnerabilities, and potential risks, providing context to assess the upgrade.

     ![PR description](https://mintcdn.com/endorlabs-b4795f4f/2CFeZIRm7eKUPEq0/images/risk-remediation/automated-pull-requests/remediation-pr-description.webp?fit=max\&auto=format\&n=2CFeZIRm7eKUPEq0\&q=85\&s=edcad4e52fd1e844a8c3a6ecd61e403e)

   * Select **Files changed** to view the changes made to the manifest files.

     ![files changed in the PR](https://mintcdn.com/endorlabs-b4795f4f/2CFeZIRm7eKUPEq0/images/risk-remediation/automated-pull-requests/remediation-pr-files-changed.webp?fit=max\&auto=format\&n=2CFeZIRm7eKUPEq0\&q=85\&s=793a8276ee75c9f6586460f8262919bb)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.