

# Identity-based policy examples for penetration testing

**Note**  
This guide covers Continuum for penetration testing, which you use in the AWS Continuum console. If you run penetration tests in the AWS Security Agent console or web application, see the [AWS Security Agent User Guide](https://docs.aws.amazon.com/securityagent/latest/userguide/what-is.html) instead. For the differences, see [Comparing Continuum for penetration testing and AWS Security Agent](pt-security-agent-comparison.md).  
Penetration testing policies in this guide use the `continuum:` action prefix and the `pentesting.continuum.amazonaws.com` service principal. AWS Security Agent policies use the `securityagent:` prefix and the `securityagent.amazonaws.com` service principal. A policy written for one service doesn't work for the other.

By default, your users and roles don't have permission to create or modify penetration testing resources, or to start runs. Your AWS Identity and Access Management (IAM) administrator must create IAM policies that grant these permissions, and then attach the policies to the users, groups, or roles that need them. Creating and attaching these policies requires administrator access. If you aren't an administrator, ask your IAM administrator to do it for you.

The following examples use the `continuum` action prefix. For more information about the actions that penetration testing uses, see [Actions for penetration testing](pt-security-iam.md#pt-security-iam-actions). For more information about policy best practices, see [Policy best practices](security_iam_id-based-policy-examples.md#security_iam_service-with-iam-policy-best-practices). For more information about creating a policy from one of these examples, see [Creating policies using the JSON editor](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create-console.html#access_policies_create-json-editor) in the *IAM User Guide*.

These examples grant the actions on all resources (`"Resource": "*"`). They don't include actions for managing integrations, such as `continuum:CreateIntegration`. For more information about other policy examples, see [Identity-based policy examples for AWS Continuum](security_iam_id-based-policy-examples.md).

## Example: Give administrators full access to penetration testing
<a name="pt-security-iam-policy-examples-full"></a>

Use this policy to give administrators full access to penetration testing. To create and attach this policy, you need administrator access to your AWS account. If you aren't an administrator, ask one to create the policy for you. With this policy, you can create environments and penetration tests, manage target domains, start and stop runs, update findings, and start code remediation.

The `ManagePenetrationTesting` statement grants the penetration testing actions. The `ManageEnvironments` statement grants the actions to create, view, update, and delete environments. This policy doesn't include `iam:PassRole`. To let users pass the environment's service role to AWS Continuum, also attach the policy in [Example: Pass the service role to AWS Continuum](#pt-security-iam-policy-examples-passrole).

The following policy grants full access to penetration testing actions and environments:

```json
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Sid": "ManagePenetrationTesting",
         "Effect": "Allow",
         "Action": [
            "continuum:ListPentests",
            "continuum:BatchGetPentests",
            "continuum:ListPentestJobsForPentest",
            "continuum:BatchGetPentestJobs",
            "continuum:BatchGetPentestJobContentMetadata",
            "continuum:ListPentestJobTasks",
            "continuum:BatchGetPentestJobTasks",
            "continuum:ListPentestActorMessages",
            "continuum:ListPentestFindings",
            "continuum:BatchGetPentestFindings",
            "continuum:ListPentestDiscoveredEndpoints",
            "continuum:ListPentestDiscoveredDomains",
            "continuum:ListPentestThreats",
            "continuum:BatchGetPentestThreats",
            "continuum:ListPentestThreatModelRunsForPentest",
            "continuum:BatchGetPentestThreatModelRuns",
            "continuum:BatchGetPentestLoginValidationRuns",
            "continuum:ListTargetDomains",
            "continuum:BatchGetTargetDomains",
            "continuum:ListPentestArtifacts",
            "continuum:GetPentestArtifact",
            "continuum:BatchGetPentestArtifactMetadata",
            "continuum:ListPentestIntegratedResources",
            "continuum:StartPentestJob",
            "continuum:StopPentestJob",
            "continuum:CreatePentest",
            "continuum:UpdatePentest",
            "continuum:BatchDeletePentests",
            "continuum:UpdatePentestFinding",
            "continuum:StartPentestCodeRemediation",
            "continuum:UpdatePentestDiscoveredDomains",
            "continuum:StartPentestLoginValidationRun",
            "continuum:StartPentestThreatModelRun",
            "continuum:StopPentestThreatModelRun",
            "continuum:CreateTargetDomain",
            "continuum:UpdateTargetDomain",
            "continuum:DeleteTargetDomain",
            "continuum:VerifyTargetDomain",
            "continuum:CreatePentestArtifact",
            "continuum:DeletePentestArtifact",
            "continuum:ListPentestResourcesFromIntegration",
            "continuum:UpdatePentestIntegratedResources"
         ],
         "Resource": "*"
      },
      {
         "Sid": "ManageEnvironments",
         "Effect": "Allow",
         "Action": [
            "continuum:GetEnvironment",
            "continuum:ListEnvironments",
            "continuum:CreateEnvironment",
            "continuum:UpdateEnvironment",
            "continuum:DeleteEnvironment"
         ],
         "Resource": "*"
      }
   ]
}
```

## Example: View penetration tests, runs, and findings
<a name="pt-security-iam-policy-examples-read"></a>

Use this policy for users who only review results. With this policy, you can view environments, penetration tests, runs and their tasks, findings, threats, target domains, and artifacts. You can't create, change, or delete anything, and you can't start or stop a run.

The following policy grants read-only access to penetration tests, runs, and findings:

```json
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Sid": "ViewPenetrationTests",
         "Effect": "Allow",
         "Action": [
            "continuum:ListPentests",
            "continuum:BatchGetPentests",
            "continuum:ListPentestJobsForPentest",
            "continuum:BatchGetPentestJobs",
            "continuum:BatchGetPentestJobContentMetadata",
            "continuum:ListPentestJobTasks",
            "continuum:BatchGetPentestJobTasks",
            "continuum:ListPentestActorMessages",
            "continuum:ListPentestFindings",
            "continuum:BatchGetPentestFindings",
            "continuum:ListPentestDiscoveredEndpoints",
            "continuum:ListPentestDiscoveredDomains",
            "continuum:ListPentestThreats",
            "continuum:BatchGetPentestThreats",
            "continuum:ListPentestThreatModelRunsForPentest",
            "continuum:BatchGetPentestThreatModelRuns",
            "continuum:BatchGetPentestLoginValidationRuns",
            "continuum:ListTargetDomains",
            "continuum:BatchGetTargetDomains",
            "continuum:ListPentestArtifacts",
            "continuum:GetPentestArtifact",
            "continuum:BatchGetPentestArtifactMetadata",
            "continuum:ListPentestIntegratedResources"
         ],
         "Resource": "*"
      },
      {
         "Sid": "ViewEnvironments",
         "Effect": "Allow",
         "Action": [
            "continuum:GetEnvironment",
            "continuum:ListEnvironments"
         ],
         "Resource": "*"
      }
   ]
}
```

## Example: Start and stop runs
<a name="pt-security-iam-policy-examples-run"></a>

Use this policy for users who run existing penetration tests but don't create, change, or delete them. In addition to the view permissions, you can start and stop runs, including threat model runs. Starting a revalidation run uses the same `continuum:StartPentestJob` action as starting a full run, so you can also revalidate findings. For more information about revalidating findings, see [Revalidating penetration test findings](pt-revalidating-findings.md).

You can't use this policy to change a finding's status or to start code remediation, because those actions change your findings and can open pull requests.

This policy grants only the permissions to start and stop runs. Attach it together with the policy in [Example: View penetration tests, runs, and findings](#pt-security-iam-policy-examples-read), which grants the permissions to view penetration tests, runs, and findings.

The following policy grants the permissions to start and stop runs:

```json
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Sid": "StartAndStopRuns",
         "Effect": "Allow",
         "Action": [
            "continuum:StartPentestJob",
            "continuum:StopPentestJob",
            "continuum:StartPentestThreatModelRun",
            "continuum:StopPentestThreatModelRun"
         ],
         "Resource": "*"
      }
   ]
}
```

## Example: Pass the service role to AWS Continuum
<a name="pt-security-iam-policy-examples-passrole"></a>

When you create or update an environment that uses an IAM role, you need permission to pass that role to AWS Continuum. Use this policy to grant that permission for a single role. The `iam:PassedToService` condition limits the permission to `pentesting.continuum.amazonaws.com`, so the role can't be passed to another service. For more information about the service role, see [Service role for penetration testing](pt-security-iam.md#pt-security-iam-service-role).

Replace `{{account-id}}` with your AWS account ID. Replace `{{role-path}}` with the IAM path of the role, and `{{role-name}}` with the name of the role. The console accepts a role from any path. When the console creates the role for you, the role is in the `/service-role/` path. For a role in the root path, omit the path and its slash.

The following policy grants permission to pass one role to AWS Continuum:

```json
{
   "Version": "2012-10-17",
   "Statement": [
      {
         "Sid": "PassPenetrationTestingServiceRole",
         "Effect": "Allow",
         "Action": "iam:PassRole",
         "Resource": "arn:aws:iam::{{account-id}}:role/{{role-path}}/{{role-name}}",
         "Condition": {
            "StringEquals": {
               "iam:PassedToService": "pentesting.continuum.amazonaws.com"
            }
         }
      }
   ]
}
```