Skip to content
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(pipelines): Secrets Manager permissions not added to asset projects #15718

Merged
merged 5 commits into from
Jul 23, 2021

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jul 22, 2021

We used to use an immutable singleton role with * permissions for the assets projects, because if there were many different destinations in a pipeline, and each asset build had to publish to each destination, the policy could grow too long and exceed the maximum policy size.

However, this also disabled the automatic policy wrangling that CodeBuild would do for us, like automatically adding permissions to bind to a VPC, and adding permissions to read Secrets Manager secrets. This especially becoming relevant since that now in the modern API, it's possible to modify build the environment in a way that normally automatically adds SecretsManager permission, but now won't (and it's not possible to fix either).

Replace the immutable singleton role with a mutable singleton role, but in such a way that it won't add permissions statements for which it already has a * statement (to cut down on duplication), and have the CB project do the automatic VPC bind permissions again.

Fixes #15628.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

(Longer description here...)

(Still needs testing...)

(Still needs the KMS key hack taken out...)

Fixes #15628.
@rix0rrr rix0rrr requested a review from a team July 22, 2021 15:16
@rix0rrr rix0rrr self-assigned this Jul 22, 2021
@gitpod-io
Copy link

gitpod-io bot commented Jul 22, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jul 22, 2021
],
});
assetRole.attachInlinePolicy(vpcPolicy);
this.assetAttachedPolicies[assetType] = vpcPolicy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The references to this.assetAttachedPolicies can be dropped from the rest of this file too.

@mergify
Copy link
Contributor

mergify bot commented Jul 23, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 1f14242
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 7668400 into master Jul 23, 2021
@mergify mergify bot deleted the huijbers/asset-role-permissions branch July 23, 2021 10:41
@mergify
Copy link
Contributor

mergify bot commented Jul 23, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Aug 3, 2021
…ts (aws#15718)

We used to use an immutable singleton role with `*` permissions for the assets projects, because if there were many different destinations in a pipeline, and each asset build had to publish to each destination, the policy could grow too long and exceed the maximum policy size.

However, this also disabled the automatic policy wrangling that CodeBuild would do for us, like automatically adding permissions to bind to a VPC, and adding permissions to read Secrets Manager secrets. This especially becoming relevant since that now in the modern API, it's possible to modify build the environment in a way that normally automatically adds SecretsManager permission, but now won't (and it's not possible to fix either).

Replace the immutable singleton role with a mutable singleton role, but in such a way that it won't add permissions statements for which it already has a `*` statement (to cut down on duplication), and have the CB project do the automatic VPC bind permissions again.

Fixes aws#15628.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…ts (aws#15718)

We used to use an immutable singleton role with `*` permissions for the assets projects, because if there were many different destinations in a pipeline, and each asset build had to publish to each destination, the policy could grow too long and exceed the maximum policy size.

However, this also disabled the automatic policy wrangling that CodeBuild would do for us, like automatically adding permissions to bind to a VPC, and adding permissions to read Secrets Manager secrets. This especially becoming relevant since that now in the modern API, it's possible to modify build the environment in a way that normally automatically adds SecretsManager permission, but now won't (and it's not possible to fix either).

Replace the immutable singleton role with a mutable singleton role, but in such a way that it won't add permissions statements for which it already has a `*` statement (to cut down on duplication), and have the CB project do the automatic VPC bind permissions again.

Fixes aws#15628.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(pipelines): missing SecretsManager permissions for asset action role
4 participants