Netflix / consoleme

A Central Control Plane for AWS Permissions and Access
Apache License 2.0
3.11k stars 253 forks source link

Roll back IAM role / resource policy with context from AWS Config #9077

Open castrapel opened 3 years ago

castrapel commented 3 years ago

AWS Config provides us with the historical policy context of IAM roles and other resources in a configuration history timeline. We want the ability to "revert" roles and resources to a previous state when provided with this context.

Please let us know if you're interested in working on this issue.

sheikhrachel commented 3 years ago

I'm interested! Do you have more details about what the desired user flow would be for this addition?

castrapel commented 3 years ago

Hi @sheikhrachel, thanks so much for your interest! I'm happy to discuss this over Meet or Zoom with you, feel free to reach out to me on Discord (curtis#9958) if you're interested.

Here are some of my initial thoughts:

It will be easier to implement the V1 MVP of this feature as view-only for end-users of ConsoleMe (End users can see a role's historical policies), and only allowing administrators to perform "Roll backs" for "IAM roles" (If desired, we can even just start with a read-only feature and add roll backs in a second PR).

Later, we can consider adding support for:

1) Rolling back other resource types 2) Adding a "request rollback" feature, where end-users can request the rollback of a role that an administrator would need to approve.

For this feature, I'm thinking about a new tab on the IAM role policy editor (example) (Perhaps called "History").

image

It would show the historical context of a role based on what AWS Config provides. End-users can view the role's JSON policy context at a certain point in history. Administrators can click a magic button to roll it back (It's fine if we want to defer the roll back functionality for V2). There are some screenshots of the resource timeline below. However you'll note that the view of the policy here isn't very readable. We'll want to parse the JSON and make it prettier. I can help with the backend code for this.

Here's what the "Resource Timeline" feature looks like in AWS: image

Here's what the policy diff view looks like (We might be able to use the MonacoDiffComponent to show this in the UI):

image

What are your thoughts?

sheikhrachel commented 3 years ago

I think v1 as read-only for all users makes the most sense. The initial work I've scoped is: Backend:

Frontend:

Extras:

v2 will include adding in the endpoint for rolling a resource back and adding that handling to the final user view if they are an administrator. But I'm anticipating that to be an easy lift once I make it over the front-end hurdle of v1 and get more familiar with the codebase.

castrapel commented 3 years ago

This sounds like a reasonable start to me.

For History, I'm thinking about starting with only IAM roles, and in future iterations, S3 buckets, SNS topics, and SQS topics. As we support policy edits and requests to additional resource types, we can also add history support for those resources (As well as rollback).

Frontend:

We could support this view in the context of the existing Policy Editor for a given resource (And just show an extra view for history). We would already have context on what resource ARN the user is viewing, and perhaps additional metadata that would be useful for querying

History view - this one's a bit subjective, and I'm open to differing opinions here. We could by default show a MonacoDiffView and having a date dropdown for the left view, and a date dropdown for the right view. By default, Right side = latest, and left side = version previous from latest.