Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,6 @@ package Cx
import data.generic.common as common_lib
import data.generic.terraform as tf_lib

CxPolicy[result] {
# Cases of "SNS Topic" or "SQS Queue" or "Lambda Function" with aws_s3_bucket_notification undefined
s3 := input.document[i].resource[type][name]
types := ["aws_sns_topic","aws_sqs_queue","aws_lambda_function"]
type == types[_]

not common_lib.valid_key(input.document[i].resource, "aws_s3_bucket_notification")

result := {
"documentId": input.document[i].id,
"resourceType": type,
"resourceName": tf_lib.get_specific_resource_name(s3, "aws_s3_bucket_notification", type),
"searchKey": sprintf("%s[%s]",[type,name]),
"issueType": "MissingAttribute",
"keyExpectedValue": "'aws_s3_bucket_notification' should be defined and not null",
"keyActualValue": "'aws_s3_bucket_notification' is undefined or null",
"searchLine": common_lib.build_search_line(["resource", type, name], []),
}
}



CxPolicy[result] {
# Cases of "SNS Topic" or "SQS Queue" or "Lambda Function" not referenced in aws_s3_bucket_notification
s3 := input.document[i].resource[type][name]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_sns_topic" "topic1" {
name = "s3-event-notification-topic"
policy = data.aws_iam_policy_document.topic.json
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_sqs_queue" "queue" {
name = "s3-event-notification-queue"
policy = data.aws_iam_policy_document.queue.json
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ resource "aws_lambda_function" "func" {
role = aws_iam_role.iam_for_lambda.arn
handler = "exports.example"
runtime = "nodejs20.x"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,5 @@
"severity": "LOW",
"line": 6,
"fileName": "positive9.tf"
},
{
"queryName": "S3 bucket notifications disabled",
"severity": "LOW",
"line": 1,
"fileName": "positive10.tf"
},
{
"queryName": "S3 bucket notifications disabled",
"severity": "LOW",
"line": 1,
"fileName": "positive11.tf"
},
{
"queryName": "S3 bucket notifications disabled",
"severity": "LOW",
"line": 1,
"fileName": "positive12.tf"
}
]
Loading