# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 --- description: | ### Document Name - ASR-PCI_3.2.1_PCI.S3.4 ## What does this document do? This document enables AES-256 as the default encryption for an S3 bucket. ## Input Parameters * Finding: (Required) Security Hub finding details JSON * AutomationAssumeRole: (Required) The ARN of the role that allows Automation to perform the actions on your behalf. ## Output Parameters * Remediation.Output ## Documentation Links * [PCI v3.2.1 S3.4](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-pci-controls.html#pcidss-s3-4) schemaVersion: '0.3' assumeRole: '{{ AutomationAssumeRole }}' outputs: - ParseInput.AffectedObject - Remediation.Output parameters: Finding: type: StringMap description: The input from the Orchestrator Step function for the PCI.S3.4 finding AutomationAssumeRole: type: String description: (Required) The ARN of the role that allows Automation to perform the actions on your behalf. allowedPattern: '^arn:(?:aws|aws-us-gov|aws-cn):iam::\d{12}:role/[\w+=,.@-]+$' RemediationRoleName: type: String default: "SO0111-EnableDefaultEncryptionS3" allowedPattern: '^[\w+=,.@-]+$' KmsKeyAlias: type: String description: (Required) KMS Customer-Managed Key (CMK) alias or the default value which is created in the SSM parameter at solution deployment (default-s3-encryption) is used to identify that the s3 bucket encryption value should be set to AES-256. default: >- {{ssm:/Solutions/SO0111/afsbp/1.0.0/S3.4/KmsKeyAlias}} allowedPattern: '^$|^[a-zA-Z0-9/_-]{1,256}$' mainSteps: - name: ParseInput action: 'aws:executeScript' outputs: - Name: AccountId Selector: $.Payload.account_id Type: String - Name: FindingId Selector: $.Payload.finding_id Type: String - Name: ProductArn Selector: $.Payload.product_arn Type: String - Name: AffectedObject Selector: $.Payload.object Type: StringMap - Name: BucketName Selector: $.Payload.resource_id Type: String inputs: InputPayload: Finding: '{{Finding}}' parse_id_pattern: '^arn:(?:aws|aws-cn|aws-us-gov):s3:::([A-Za-z0-9.-]{3,63})$' expected_control_id: [ 'PCI.S3.4' ] Runtime: python3.8 Handler: parse_event Script: |- %%SCRIPT=common/parse_input.py%% - name: Remediation action: 'aws:executeAutomation' isEnd: false inputs: DocumentName: ASR-EnableDefaultEncryptionS3 RuntimeParameters: AccountId: '{{ParseInput.AccountId}}' BucketName: '{{ParseInput.BucketName}}' AutomationAssumeRole: 'arn:{{global:AWS_PARTITION}}:iam::{{global:ACCOUNT_ID}}:role/{{RemediationRoleName}}' KmsKeyAlias: '{{KmsKeyAlias}}' - name: UpdateFinding action: 'aws:executeAwsApi' inputs: Service: securityhub Api: BatchUpdateFindings FindingIdentifiers: - Id: '{{ParseInput.FindingId}}' ProductArn: '{{ParseInput.ProductArn}}' Note: Text: 'Enabled default encryption for {{ParseInput.BucketName}}' UpdatedBy: 'ASR-PCI_3.2.1_PCI.S3.4' Workflow: Status: RESOLVED description: Update finding isEnd: true