aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.68k stars 3.93k forks source link

toolkit: limit default security warnings to "risky" changes #1264

Closed rix0rrr closed 2 years ago

rix0rrr commented 5 years ago

Right now, the toolkit will warn on ANY IAM/SecurityGroup widening. We should probably restrict this to "risky" changes in order to avoid alarm fatigue.

With the current implementation, it will most likely put up warnings on every deployment that adds new resources, as most of them involve creating a new IAM role.


Attacks

Here are some attack scenarios (by 3rd party construct library authors) that we should ideally be able to detect.

rix0rrr commented 5 years ago

Proposing the following guiding principle:

Things "external" to the template are risky. This includes things external to the account, which are even more risky. Relationships between objects internal to the template should be considered non-risky.

rix0rrr commented 5 years ago

I know I should write these things in a MarkDown document, but I'm putting my thoughts here right now because I don't want to switch branches.


I'm proposing the following rules:

IAM

Security Groups

Prefix Lists are all AWS managed so we trust them.

We ignore egress. Enterprises worried about exfiltration have a variety of other options to work with (stricted CDK checking level, inspecting the CDK machine-readable diff, putting boxes in Isolated subnets; general AWS offerings such as VPC flow logs, a variety of security-posture checking tools announced at reinvent, ...).


Some implementation notes flying through my head:

eladb commented 5 years ago

I disagree that "template-locality" implies less risk. One of the main drivers for improving this diff UI is in order to ensure that when people use 3rd party constructs in their code, those constructs will not expose their applications to unwanted risk and/or attacks.

I agree that we'll probably eventually want to reduce noise around these warnings, but I would rather give this some "bake time" and feel it out before we implement any filters.

rix0rrr commented 5 years ago

I would rather give this some "bake time" and feel it out before we implement any filters.

Agreed, but it doesn't hurt to start thinking about it. Also, I fear the requests for filtering are going to come in sooner rather than later.

I disagree that "template-locality" implies less risk.

We should come up with some potential attacks. I'll add them to the post.

lroling8350 commented 5 years ago

If/when this idea gets implemented any thoughts on opening it up as a plugin and letting downstream users choose their rules so they could vary the level of risk? The scenario I have is allowing developers to create CDK apps but sending out request for approval when deploying a stack with permission changes. A plugin would allow us to customize the security level as well as a possible post out to a third party app for approval before continuing.

PS. This is an awesome project and I really like the direction it's heading in.

github-actions[bot] commented 2 years ago

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.