# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 --- description: | ### Document Name - ASR-AFSBP_1.0.0_S3.6 ## What does this document do? This document restricts cross-account access to a bucket in the local account. ## 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 * [AFSBP v1.0.0 S3.6](https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-standards-fsbp-controls.html#fsbp-s3-6) schemaVersion: '0.3' assumeRole: '{{ AutomationAssumeRole }}' outputs: - ParseInput.AffectedObject - Remediation.Output parameters: Finding: type: StringMap description: The input from the Orchestrator Step function for the S3.6 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-S3BlockDenylist" allowedPattern: '^[\w+=,.@-]+$' mainSteps: - name: ParseInput action: 'aws:executeScript' outputs: - Name: BucketName Selector: $.Payload.resource_id Type: String - Name: AffectedObject Selector: $.Payload.object Type: StringMap - Name: FindingId Selector: $.Payload.finding.Id Type: String - Name: ProductArn Selector: $.Payload.finding.ProductArn Type: String - Name: ConfigRuleName Selector: $.Payload.aws_config_rule.ConfigRuleName Type: String - Name: DenyListSerialized Selector: $.Payload.aws_config_rule.InputParameters 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: [ 'S3.6' ] Runtime: python3.8 Handler: parse_event Script: |- %%SCRIPT=common/parse_input.py%% - name: ExtractSensitiveApis action: 'aws:executeScript' inputs: InputPayload: SerializedList: '{{ ParseInput.DenyListSerialized }}' Runtime: python3.8 Handler: runbook_handler Script: |- %%SCRIPT=deserializeApiList.py%% outputs: - Name: ListOfApis Selector: $.Payload Type: String - name: Remediation action: 'aws:executeAutomation' inputs: DocumentName: ASR-S3BlockDenylist RuntimeParameters: BucketName: '{{ParseInput.BucketName}}' AutomationAssumeRole: 'arn:{{global:AWS_PARTITION}}:iam::{{global:ACCOUNT_ID}}:role/{{RemediationRoleName}}' DenyList: '{{ExtractSensitiveApis.ListOfApis}}' - name: UpdateFinding action: 'aws:executeAwsApi' inputs: Service: securityhub Api: BatchUpdateFindings FindingIdentifiers: - Id: '{{ParseInput.FindingId}}' ProductArn: '{{ParseInput.ProductArn}}' Note: Text: 'Added explicit deny for sensitive bucket access from another account.' UpdatedBy: 'ASR-AFSBP_1.0.0_S3.6' Workflow: Status: RESOLVED description: Update finding isEnd: true