- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.3k
Closed
Labels
@aws-cdk/aws-kmsRelated to AWS Key ManagementRelated to AWS Key Managementeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
[Not a Contribution]
Default KMS policy created with allowAccountToAdmin() function (trustAccountIdentities=false) is too large and allow all IAM entities to manage the Key.
At least, there should be an additionnal option to restrict it to ROOT only. Or restriction to ROOT only should be the default option.
Proposed solution is to add a condition in the statement as below:
{
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::AccountID:root"
            },
            "Action": [
                "kms:Create*",
                "kms:Describe*",
                "kms:Enable*",
                "kms:List*",
                "kms:Put*",
                "kms:Update*",
                "kms:Revoke*",
                "kms:Disable*",
                "kms:Get*",
                "kms:Delete*",
                "kms:ScheduleKeyDeletion",
                "kms:CancelKeyDeletion",
                "kms:GenerateDataKey",
                "kms:TagResource",
                "kms:UntagResource"
            ],
            "Resource": "*",
            "Condition": {
                "ArnLike": {
                    "aws:PrincipalArn": "arn:aws:iam::AccountID:root"
                }
            }
        }
Reproduction Steps
Create a KMS key with default policy:
new kms.Key(this, 'KmsKey', {
      alias: 'kms-key',
      enableKeyRotation: true
    });
Error Log
No error produced by CDK
Environment
- CDK CLI Version: 1.49.1
- Module Version: aws-kms
- Node.js Version: v12.13.1
- OS: All
- Language: all
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-kmsRelated to AWS Key ManagementRelated to AWS Key Managementeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2