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

(pipelines/bootstrap): add Permission Boundary to bootstrap resources #12207

Open
rix0rrr opened this issue Dec 23, 2020 · 14 comments
Open

(pipelines/bootstrap): add Permission Boundary to bootstrap resources #12207

rix0rrr opened this issue Dec 23, 2020 · 14 comments
Labels
@aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@rix0rrr
Copy link
Contributor

rix0rrr commented Dec 23, 2020

The cdk bootstrap command will be able to be invoked as follows:

$ cdk bootstrap --permissions-boundary=arn:aws:iam::account-id:policy/policy-name-with-path

This sets the CloudFormation Execution Role up to enforce its use.

When users add:

{
  "context": {
    "@aws-cdk/core.permissionsBoundary": "arn:aws:iam::account-id:policy/policy-name-with-path"
  }
}

To their cdk.json, all Roles in all stacks will be provisioned with that permission boundary automatically.


This is a 🚀 Feature Request

@rix0rrr rix0rrr added p1 feature-request A feature should be added or improved. effort/large Large work item – several weeks of effort needs-triage This issue or PR still needs to be triaged. @aws-cdk/pipelines CDK Pipelines library labels Dec 23, 2020
@redbaron
Copy link
Contributor

Could you provide an example of Control Plane and Data plane calls?

@rix0rrr
Copy link
Contributor Author

rix0rrr commented Dec 23, 2020

Could you provide an example of Control Plane and Data plane calls?

Sure. Control Plane calls are (typically) calls that configure services, while Data Plane calls are calls that use services.

Some examples:

Service Control Plane Data Plane
S3 CreateBucket, PutBucketPolicy PutObject, GetObject
SQS CreateQueue, PutQueuePolicy SendMessage, ReceiveMessages, DeleteMessage
DDB CreateTable, TagResource, UpdateTable PutItem, Scan, Query

Some calls might be debatable. For example, ListBuckets could be considered a Control Plane call but it might equally well be considered a Data Plane call.

At the same time, it's reasonable to think that it's fine for applications to create some resources as part of their normal operation, like perhaps creating SQS Queues and SNS Topics on-demand, so it's not entirely cut-and-dry what calls should be allowed and disallowed for execution roles. But these are details that can be worked out; the bigger question is whether the whole scheme would have value to it in the first place.

@hoegertn
Copy link
Contributor

One thing that comes to my mind is: How would I deploy Lambda functions with ops tasks using CDK if all roles are denied control plane access.

I am not sure this approach is really helpful or if it is a form of snake oil.

The main entry point for any attacker is still the repository itself and there is no way to mitigate this completely. So we need to make sure safeguards are in place here.

@rix0rrr rix0rrr changed the title (pipelines/bootstrap): change default pipeline policy to use permission boundaries [discuss] (pipelines/bootstrap): change default pipeline policy to use permission boundaries Jan 7, 2021
@Wenzil
Copy link
Contributor

Wenzil commented Jan 18, 2021

@hoegertn you still want to limit the damage if there is a breach

@rix0rrr I think this is a great option to have. We are anyway going with a similar approach using our custom bootstrap template. +1 for providing more secure defaults

@rix0rrr rix0rrr changed the title [discuss] (pipelines/bootstrap): change default pipeline policy to use permission boundaries (pipelines/bootstrap): add Permission Boundary to bootstrap resources Jan 29, 2021
@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p2 and removed effort/large Large work item – several weeks of effort p1 labels Jan 29, 2021
@rix0rrr rix0rrr added this to the [GA] CDK Pipelines milestone Jan 29, 2021
greg-aws added a commit to greg-aws/aws-cdk that referenced this issue Apr 27, 2021
… role prefix and default permission boundaries. Closes aws#12207
greg-aws added a commit to greg-aws/aws-cdk that referenced this issue May 5, 2021
@rix0rrr rix0rrr removed this from the [GA] CDK Pipelines milestone May 6, 2021
@greg-aws
Copy link
Contributor

greg-aws commented May 9, 2021

I believe this issue can be closed once #14568 is merged. The use of the PermissionBoundary construct I think may satisfy the other aspect of this issue. @rix0rrr do you agree?

@ryparker ryparker removed the needs-triage This issue or PR still needs to be triaged. label Jun 2, 2021
@patrickmryan
Copy link

This issue is still not resolved. While it is possible to add a permissions boundary on a CDK stack, the bootstrap process does not include the option to attach a boundary policy to the IAM roles created by the bootstrap. As a result, the bootstrap process will fail if it is executed in an environment where we are not permitted to create an IAM role without a boundary policy.

I forked the repo and will work on this feature myself.

@kjjuno
Copy link

kjjuno commented Feb 4, 2022

@patrickmryan thank you! I very much need this feature as well. I am unable to bootstrap our account with the current version because of permission boundary issues.

@patrickmryan
Copy link

patrickmryan commented Feb 4, 2022 via email

@kjjuno
Copy link

kjjuno commented Feb 7, 2022

@patrickmryan
Copy link

patrickmryan commented Feb 7, 2022 via email

@kjjuno
Copy link

kjjuno commented Feb 8, 2022

works like a charm. Thanks so much!

@viktorchukhantsev
Copy link

@patrickmryan Thank you. Can you also please attach example policy for boundary in GH repo? I have issues with defining that policy due to lack of knowledge about AWS policies and boundary permissions.

@joehillen
Copy link
Contributor

This indicates that support for this has been added, but I can't find a way to specify InputPermissionsBoundary during bootstrap.

@joehillen
Copy link
Contributor

Ah ha! It's a secret option that is not documented here or in --help.

cdk bootstrap --custom-permissions-boundary MY_BOUNDARY

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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

10 participants