-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7097 from Checkmarx/tf_bug_principals
fix(query): policy without principal query with false positive for IAM role used as an inline policy
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
assets/queries/terraform/aws/policy_without_principal/test/negative4.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
data "aws_iam_policy_document" "example" { | ||
statement { | ||
actions = [ | ||
"cloudwatch:PutMetricData", | ||
] | ||
|
||
resources = ["*"] | ||
} | ||
} | ||
|
||
data "aws_iam_policy_document" "lambda_assume" { | ||
statement { | ||
actions = [ | ||
"sts:AssumeRole", | ||
] | ||
principals { | ||
type = "Service" | ||
identifiers = [ | ||
"lambda.amazonaws.com" | ||
] | ||
} | ||
} | ||
} | ||
|
||
resource "aws_iam_role" "example" { | ||
name = "example-role" | ||
assume_role_policy = data.aws_iam_policy_document.lambda_assume.json | ||
|
||
inline_policy { | ||
name = "default" | ||
policy = data.aws_iam_policy_document.example.json | ||
} | ||
} |