forked from Checkmarx/kics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(query): added support to tf modules for S3 Bucket Allows Public …
…Policy (Checkmarx#4268) Signed-off-by: João Reigota <[email protected]>
- Loading branch information
1 parent
be18968
commit 352f574
Showing
7 changed files
with
143 additions
and
2 deletions.
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
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
assets/queries/terraform/aws/s3_bucket_with_public_policy/test/negative2.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,32 @@ | ||
module "s3_bucket" { | ||
source = "terraform-aws-modules/s3-bucket/aws" | ||
version = "3.7.0" | ||
|
||
bucket = "my-s3-bucket" | ||
acl = "private" | ||
restrict_public_buckets = true | ||
block_public_acls = true | ||
block_public_policy = true | ||
|
||
versioning = { | ||
enabled = true | ||
} | ||
|
||
policy = <<POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Id": "MYBUCKETPOLICY", | ||
"Statement": [ | ||
{ | ||
"Sid": "IPAllow", | ||
"Effect": "Deny", | ||
"Action": "s3:*", | ||
"Resource": "arn:aws:s3:::my_tf_test_bucket/*", | ||
"Condition": { | ||
"IpAddress": {"aws:SourceIp": "8.8.8.8/32"} | ||
} | ||
} | ||
] | ||
} | ||
POLICY | ||
} |
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
assets/queries/terraform/aws/s3_bucket_with_public_policy/test/positive2.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,32 @@ | ||
module "s3_bucket" { | ||
source = "terraform-aws-modules/s3-bucket/aws" | ||
version = "3.7.0" | ||
|
||
bucket = "my-s3-bucket" | ||
acl = "private" | ||
restrict_public_buckets = true | ||
block_public_acls = true | ||
block_public_policy = false | ||
|
||
versioning = { | ||
enabled = true | ||
} | ||
|
||
policy = <<POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Id": "MYBUCKETPOLICY", | ||
"Statement": [ | ||
{ | ||
"Sid": "IPAllow", | ||
"Effect": "Deny", | ||
"Action": "s3:*", | ||
"Resource": "arn:aws:s3:::my_tf_test_bucket/*", | ||
"Condition": { | ||
"IpAddress": {"aws:SourceIp": "8.8.8.8/32"} | ||
} | ||
} | ||
] | ||
} | ||
POLICY | ||
} |
31 changes: 31 additions & 0 deletions
31
assets/queries/terraform/aws/s3_bucket_with_public_policy/test/positive3.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,31 @@ | ||
module "s3_bucket" { | ||
source = "terraform-aws-modules/s3-bucket/aws" | ||
version = "3.7.0" | ||
|
||
bucket = "my-s3-bucket" | ||
acl = "private" | ||
restrict_public_buckets = true | ||
block_public_acls = true | ||
|
||
versioning = { | ||
enabled = true | ||
} | ||
|
||
policy = <<POLICY | ||
{ | ||
"Version": "2012-10-17", | ||
"Id": "MYBUCKETPOLICY", | ||
"Statement": [ | ||
{ | ||
"Sid": "IPAllow", | ||
"Effect": "Deny", | ||
"Action": "s3:*", | ||
"Resource": "arn:aws:s3:::my_tf_test_bucket/*", | ||
"Condition": { | ||
"IpAddress": {"aws:SourceIp": "8.8.8.8/32"} | ||
} | ||
} | ||
] | ||
} | ||
POLICY | ||
} |
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