

# Remediating a penetration test finding

When you view the findings for a penetration test, you can ask AWS Continuum to attempt to remediate a finding. For a connected private repository, AWS Continuum opens a pull request (or a merge request, for GitLab) with the proposed fix.

## Prerequisites
<a name="pt-remediating-findings-prerequisites"></a>

Before you begin, ensure that you have the following:
+ A completed or in-progress penetration test run
+ A GitHub or GitLab integration, and the repositories of your application added to the penetration test as source repositories. To create an integration, see [GitHub](integrations.md#integrations-github) or [GitLab](integrations.md#integrations-gitlab).
+ Permission to start code remediation, which is the `continuum:StartPentestCodeRemediation` action. For example policies, see [Identity-based policy examples for penetration testing](pt-security-iam-policy-examples.md).
+ Familiarity with the architecture and security requirements of your application

## Step 1: Enable or disable automatic remediation
<a name="pt-remediating-findings-enable"></a>

You configure code remediation when you create or modify a penetration test. If you enable automatic remediation, AWS Continuum automatically attempts to remediate a finding when it confirms the finding during the penetration test. You can also start code remediation manually for a finding.

**To enable automatic code remediation**

1. Open the penetration test for editing, and go to the **Additional configuration** page.

1. For **Code remediation**, enable or disable code remediation.

1. Save the penetration test.

## Step 2: Select repositories for code remediation
<a name="pt-remediating-findings-repositories"></a>

AWS Continuum opens pull requests in the source repositories of the penetration test. Add the repositories that you want to use for code remediation as source repositories.

**To select repositories**

1. On the **Penetration test details** page, in **Source code and documents**, choose your source code provider, for example your GitHub repositories.

1. Select the repositories that you want to use for code remediation.

1. Save the penetration test.

## Step 3: Start a penetration test and view findings
<a name="pt-remediating-findings-run"></a>

Run the penetration test to detect findings. For more information, see [Starting a run](pt-creating-test.md#pt-creating-test-start) and [Viewing penetration test findings](pt-viewing-findings.md).

## Step 4: Start and view code remediation
<a name="pt-remediating-findings-start"></a>

**To start and view code remediation**

1. Open the finding.

1. If you enabled automatic code remediation, a code remediation starts once AWS Continuum confirms the finding. To start a code remediation manually, choose **Remediate code**.

1. In the **Code Remediation** section of the finding, view the status of the code remediation and the links to the pull requests or merge requests.

The status of a code remediation is **In progress**, **Completed**, or **Failed**. When a code remediation fails, the section shows the reason.

After you merge a fix, revalidate the finding to confirm that the vulnerability is resolved. To revalidate, see [Revalidating penetration test findings](pt-revalidating-findings.md).