Skip to content

Commit b2d9a0b

Browse files
committed
eli-385 restricting kms key decryption to only those keys created in the account
1 parent 9626a17 commit b2d9a0b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

infrastructure/stacks/iams-developer-roles/github_actions_policies.tf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,24 +343,22 @@ resource "aws_iam_policy" "kms_creation" {
343343
{
344344
Effect = "Allow",
345345
Action = [
346+
# Key creation and listing actions require wildcard resource
346347
"kms:CreateKey",
347-
"kms:DescribeKey",
348348
"kms:CreateAlias",
349349
"kms:List*",
350-
"kms:ListAliases",
351-
"kms:Decrypt",
352-
"kms:Encrypt",
353-
"kms:ReEncrypt*",
350+
"kms:ListAliases"
354351
],
355352
Resource = "*"
356353
},
357354
{
358355
Effect = "Allow",
359356
Action = [
357+
# Key management actions on account-specific keys only
358+
"kms:DescribeKey",
360359
"kms:Describe*",
361360
"kms:GetKeyPolicy*",
362361
"kms:GetKeyRotationStatus",
363-
"kms:Decrypt*",
364362
"kms:DeleteAlias",
365363
"kms:UpdateKeyDescription",
366364
"kms:CreateGrant",
@@ -369,8 +367,9 @@ resource "aws_iam_policy" "kms_creation" {
369367
"kms:ScheduleKeyDeletion",
370368
"kms:PutKeyPolicy",
371369
"kms:Encrypt",
372-
"kms:TagResource",
373-
"kms:GenerateDataKey",
370+
"kms:Decrypt",
371+
"kms:ReEncrypt*",
372+
"kms:GenerateDataKey"
374373
],
375374
Resource = [
376375
"arn:aws:kms:${var.default_aws_region}:${data.aws_caller_identity.current.account_id}:key/*",

0 commit comments

Comments
 (0)