-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): codepipeline cross account action fails writing output artifacts #6594
Conversation
…iting outputArtifacts
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@@ -337,7 +337,8 @@ | |||
"s3:GetObject*", "s3:GetBucket*", | |||
"s3:List*", "s3:Abort*", | |||
"s3:DeleteObject*", "s3:PutObject*", | |||
"kms:Decrypt", "kms:DescribeKey" | |||
"kms:Decrypt", "kms:DescribeKey", "kms:Encrypt", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like the reasons we add each of these permissions to be documented somewhere in-line. Can you think of a good place? (Unfortunately JSON doesn't allow comments... Sids?)
The policy you quoted gives the role access to the key VIA S3, but the failing call in CloudTrail said the call was performed directly by CodePipeline (hence the policy denied it). No idea why that would be different. Maybe that's because there's a cross-account bucket access involved? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…iting outputArtifacts (#6594) To allow cross account actions in codepipeline we create a role in the other account which is assumable by codepipeline. Since the artifacts are stored in an encrypted S3 bucket in the code pipeline account, the role in the other account must have permission to access the bucket and KMS key in the codepipeline account. To give the role permissions to access the bucket and key two type of policies are required: 1. The policy defined on the bucket and key must give the other account permissions to perform all required actions. 2. The role policy must allow all required actions Policy **1** is defined by the codepipeline construct. The role in the other account is created via the (new) bootstrap command and is defined as `DeploymentActionRole` in the `bootstrap-template.json` file. To satisfy **2**, the policy attached to the role must allow the required S3 and KMS actions. The policy attached to the role was missing the required KMS actions to allow writing the output artifacts to the S3 bucket. This commits adds `kms:Encrypt`, `kms:ReEncrypt `, `kms:GenerateDataKey ` to the `DeploymentActionRole` attached policy
…iting outputArtifacts (aws#6594) To allow cross account actions in codepipeline we create a role in the other account which is assumable by codepipeline. Since the artifacts are stored in an encrypted S3 bucket in the code pipeline account, the role in the other account must have permission to access the bucket and KMS key in the codepipeline account. To give the role permissions to access the bucket and key two type of policies are required: 1. The policy defined on the bucket and key must give the other account permissions to perform all required actions. 2. The role policy must allow all required actions Policy **1** is defined by the codepipeline construct. The role in the other account is created via the (new) bootstrap command and is defined as `DeploymentActionRole` in the `bootstrap-template.json` file. To satisfy **2**, the policy attached to the role must allow the required S3 and KMS actions. The policy attached to the role was missing the required KMS actions to allow writing the output artifacts to the S3 bucket. This commits adds `kms:Encrypt`, `kms:ReEncrypt `, `kms:GenerateDataKey ` to the `DeploymentActionRole` attached policy
…iting outputArtifacts (#6594) To allow cross account actions in codepipeline we create a role in the other account which is assumable by codepipeline. Since the artifacts are stored in an encrypted S3 bucket in the code pipeline account, the role in the other account must have permission to access the bucket and KMS key in the codepipeline account. To give the role permissions to access the bucket and key two type of policies are required: 1. The policy defined on the bucket and key must give the other account permissions to perform all required actions. 2. The role policy must allow all required actions Policy **1** is defined by the codepipeline construct. The role in the other account is created via the (new) bootstrap command and is defined as `DeploymentActionRole` in the `bootstrap-template.json` file. To satisfy **2**, the policy attached to the role must allow the required S3 and KMS actions. The policy attached to the role was missing the required KMS actions to allow writing the output artifacts to the S3 bucket. This commits adds `kms:Encrypt`, `kms:ReEncrypt `, `kms:GenerateDataKey ` to the `DeploymentActionRole` attached policy
To allow cross account actions in codepipeline we create a role in the other account which is assumable by codepipeline. Since the artifacts are stored in an encrypted S3 bucket in the code pipeline account, the role in the other account must have permission to access the bucket and KMS key in the codepipeline account. To give the role permissions to access the bucket and key two type of policies are required:
Policy 1 is defined by the codepipeline construct.
The role in the other account is created via the (new) bootstrap command and is defined as
DeploymentActionRole
in thebootstrap-template.json
file. To satisfy 2, the policy attached to the role must allow the required S3 and KMS actions. The policy attached to the role was missing the required KMS actions to allow writing the output artifacts to the S3 bucket. This commits addskms:Encrypt
,kms:ReEncrypt
,kms:GenerateDataKey
to theDeploymentActionRole
attached policyBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license