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

docs(pipelines): add CI/CD account bootstrap template example #12352

Merged
merged 6 commits into from
Feb 25, 2021

Conversation

flochaz
Copy link
Contributor

@flochaz flochaz commented Jan 5, 2021


This PR add details about how you can restrict the bootstrapping role permissions and especially if you have a multi-accounts structure with a de dedicated account for CI/CD pipelines.

It makes reference to a template used in an other project leveraging the CDK pipelines construct in a multi-accounts organization.

This template follow the least privileges principle and restrict as much as possible permissions to enable user to only create resources needed by the cdk pipelines construct (specific roles, kms keys, buckets, codepipelines etc.).

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

@gitpod-io
Copy link

gitpod-io bot commented Jan 5, 2021

@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@flochaz flochaz changed the title Add CI/CD account bootstrap template example docs: Add CI/CD account bootstrap template example Jan 5, 2021
Comment on lines 659 to 661
> On this note, if you have an account dedicated to CI/CD pipelines you can tailored
> the permission granted to only allow pipelines' resources to be deployed by bootstraping
> it with the `--template` option with a template such as [this one](https://raw.githubusercontent.com/aws-samples/aws-bootstrap-kit-examples/main/source/1-SDLC-organization/lib/cdk-bootstrap-template.yml).
Copy link

Choose a reason for hiding this comment

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

The challenge we have is that CI/CD pipelines typically can create a role (for CodeBuild for example) . The role could have very permissive permission and developers can do anything in CodeBuild's ShellScriptAction.

I'll go with making readers aware of the risk, and introduce the solution:


"If your policy includes permissions to create on attach permission to a role, developers can escalate their privilege by creating a new role with more permissive permission. Thus, we recommend to implement permissions boundary in the CDK Execution role. To do this, you can bootstrap with the --template option with a customized template that contains a permission boundary."

@NGL321 NGL321 changed the title docs: Add CI/CD account bootstrap template example docs(pipelines): Add CI/CD account bootstrap template example Jan 23, 2021
@NGL321 NGL321 changed the title docs(pipelines): Add CI/CD account bootstrap template example docs(pipelines): add CI/CD account bootstrap template example Jan 23, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Jan 23, 2021
rix0rrr
rix0rrr previously requested changes Feb 9, 2021
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

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

I had to re-read this a couple of times and I still don't quite get what it's trying to say.

I like @ijemmy's phrasing better, at least it's clear in what it's trying to get you to do.

On that note: how would you feel about migrating your template changes into the CDK bootstrap template proper (using a parameter) and turning this into a how-to-use section?

See here: #12207

@mergify mergify bot dismissed rix0rrr’s stale review February 9, 2021 14:03

Pull request has been modified.

rix0rrr
rix0rrr previously approved these changes Feb 9, 2021
@mergify
Copy link
Contributor

mergify bot commented Feb 9, 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).

@mergify mergify bot dismissed rix0rrr’s stale review February 16, 2021 11:09

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Feb 25, 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: f8bafff
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Feb 25, 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).

@mergify mergify bot merged commit 88e933f into aws:master Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants