Conversation
| git_repo = "iac-demo" | ||
| yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1" | ||
| } | ||
| } |
There was a problem hiding this comment.
| } | |
| acl = "private" |
AWS S3 bucket ACL grants READ permission to everyone
Resource: aws_s3_bucket.data | Policy ID: 807152304871829504_AWS_1670654004846 | Checkov ID: CKV_AWS_20
Description
https://docs.bridgecrew.io/docs/s3_1-acl-read-permissions-everyoneBenchmarks
- NIST-800-53 AC-17
🎉 Fixed by commit ac01ce3 - Prisma Cloud bot fix for terraform/aws/s3.tf
| git_repo = "iac-demo" | ||
| yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1" | ||
| } | ||
| } |
There was a problem hiding this comment.
AWS Access logging not enabled on S3 buckets
Resource: aws_s3_bucket.data | Bridgecrew ID: BC_AWS_S3_13 | Checkov ID: CKV_AWS_18
How to Fix
resource "aws_s3_bucket" "bucket" {
acl = var.s3_bucket_acl
bucket = var.s3_bucket_name
policy = var.s3_bucket_policy
force_destroy = var.s3_bucket_force_destroy
versioning {
enabled = var.versioning
mfa_delete = var.mfa_delete
}
+ dynamic "logging" {
+ for_each = var.logging
+ content {
+ target_bucket = logging.value["target_bucket"]
+ target_prefix = "log/${var.s3_bucket_name}"
+ }
+ }
}Description
Access logging provides detailed audit logging for all objects and folders in an S3 bucket.Benchmarks
- HIPAA 164.312(B) Audit controls
| git_repo = "iac-demo" | ||
| yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1" | ||
| } | ||
| } |
There was a problem hiding this comment.
Testing Bucket with encryption
Resource: aws_s3_bucket.data | Bridgecrew ID: cb404a47-3b88-40eb-b6ad-94081e055e6a
| git_repo = "iac-demo" | ||
| yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1" | ||
| } | ||
| } |
There was a problem hiding this comment.
AWS S3 Object Versioning is disabled
Resource: aws_s3_bucket.data | Bridgecrew ID: 807152304871829504_AWS_1658427621485 | Checkov ID: CKV_AWS_21
Description
https://docs.bridgecrew.io/docs/s3_16-enable-versioningThere was a problem hiding this comment.
Change details
-
Error ID Change Path Resource 807152304871829504_AWS_1670654004846 Fixed /terraform/aws/s3.tf aws_s3_bucket.data
| Privacy = "public" | ||
| Proj = "prisma-cloud-pov" | ||
| } | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| resource "aws_s3_bucket_versioning" "public_bucket" { | |
| bucket = aws_s3_bucket.public_bucket.id | |
| versioning_configuration { | |
| status = "Enabled" | |
| } | |
| } | |
| resource "aws_s3_bucket" "destination" { | |
| bucket = aws_s3_bucket.public_bucket.id | |
| versioning_configuration { | |
| status = "Enabled" | |
| } | |
| } | |
| resource "aws_iam_role" "replication" { | |
| name = "aws-iam-role" | |
| assume_role_policy = <<POLICY | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Action": "sts:AssumeRole", | |
| "Principal": { | |
| "Service": "s3.amazonaws.com" | |
| }, | |
| "Effect": "Allow", | |
| "Sid": "" | |
| } | |
| ] | |
| } | |
| POLICY | |
| } | |
| resource "aws_s3_bucket_replication_configuration" "public_bucket" { | |
| depends_on = [aws_s3_bucket_versioning.public_bucket] | |
| role = aws_iam_role.public_bucket.arn | |
| bucket = aws_s3_bucket.public_bucket.id | |
| rule { | |
| id = "foobar" | |
| status = "Enabled" | |
| destination { | |
| bucket = aws_s3_bucket.destination.arn | |
| storage_class = "STANDARD" | |
| } | |
| } | |
| } |
S3 bucket cross-region replication disabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: BC_AWS_GENERAL_72 | Checkov ID: CKV_AWS_144
How to Fix
resource "aws_s3_bucket" "test" {
...
+ replication_configuration {
+ role = aws_iam_role.replication.arn
+ rules {
+ id = "foobar"
+ prefix = "foo"
+ status = "Enabled"
+
+ destination {
+ bucket = aws_s3_bucket.destination.arn
+ storage_class = "STANDARD"
+ }
+ }
+ }
}Description
Cross-region replication enables automatic, asynchronous copying of objects across S3 buckets. By default, replication supports copying new S3 objects after it is enabled. It is also possible to use replication to copy existing objects and clone them to a different bucket, but in order to do so, you must contact AWS Support.| Privacy = "public" | ||
| Proj = "prisma-cloud-pov" | ||
| } | ||
| } |
There was a problem hiding this comment.
| } | |
| } | |
| resource "aws_s3_bucket_server_side_encryption_configuration" "public_bucket" { | |
| bucket = aws_s3_bucket.public_bucket.bucket | |
| rule { | |
| apply_server_side_encryption_by_default { | |
| sse_algorithm = "aws:kms" | |
| } | |
| } | |
| } |
S3 buckets are not encrypted with KMS
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: BC_AWS_GENERAL_56 | Checkov ID: CKV_AWS_145
How to Fix
resource "aws_s3_bucket" "bucket_name" {
bucket = "bucket_good"
}
+ resource "aws_s3_bucket_server_side_encryption_configuration" "good_sse_1" {
+ bucket = aws_s3_bucket.bucket_name.bucket
+
+ rule {
+ apply_server_side_encryption_by_default {
+ kms_master_key_id = aws_kms_key.mykey.arn
+ sse_algorithm = "aws:kms"
+ }
+ }
+ }Description
Encrypting your data and resources with KMS helps protect your data from unauthorized access or tampering. By encrypting your data, you can ensure that only authorized users can access and decrypt the data, and that the data is protected while in storage or in transit. Such action can help protect against external threats such as hackers or malware, as well as internal threats such as accidental or unauthorized access.| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
AWS S3 Object Versioning is disabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658427621485 | Checkov ID: CKV_AWS_21
Description
https://docs.bridgecrew.io/docs/s3_16-enable-versioning| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
everitt-build-1
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1678303513602
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
S3 Bucket does not have public access blocks
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: BC_AWS_NETWORKING_52 | Checkov ID: CKV2_AWS_6
How to Fix
resource "aws_s3_bucket" "bucket_good_1" {
bucket = "bucket_good"
}
resource "aws_s3_bucket_public_access_block" "access_good_1" {
bucket = aws_s3_bucket.bucket_good_1.id
block_public_acls = true
block_public_policy = true
}
Description
When you create an S3 bucket, it is good practice to set the additional resource **aws_s3_bucket_public_access_block** to ensure the bucket is never accidentally public.We recommend you ensure S3 bucket has public access blocks. If the public access block is not attached it defaults to False.
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
test_pccs_rule1-EVERITT
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658067543241
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Weib - Check for classified S3 bucket without server-side encryption enabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1659266345263
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
All S3 Buckets must have a tag with key Classification and have versioning enabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1643813941482
Description
Ensure that S3 bucket have a classification tag| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Testing Bucket with encryption
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: cb404a47-3b88-40eb-b6ad-94081e055e6a
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Jety_Policy_S3 Tag
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658067543253
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
VSCode Check
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1651820063408
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
DM_TEST_tags
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1678109938201
Description
test| } | ||
|
|
||
| # Create a random string | ||
| resource "random_string" "random" { |
There was a problem hiding this comment.
DM_TEST_tags
Resource: random_string.random | Bridgecrew ID: 807152304871829504_AWS_1678109938201
Description
test| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
SM test - build policy
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1656555386808
Description
Enable versioning| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
test_pccs_rule1-EVERITT
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658067543241
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
SM test - build policy
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1656555386808
Description
Enable versioning| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Testing Bucket with encryption
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: cb404a47-3b88-40eb-b6ad-94081e055e6a
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
DM_TEST_tags
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1678109938201
Description
test| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Jety_Policy_S3 Tag
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658067543253
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
VSCode Check
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1651820063408
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
Weib - Check for classified S3 bucket without server-side encryption enabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1659266345263
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
AWS S3 Object Versioning is disabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1658427621485 | Checkov ID: CKV_AWS_21
Description
https://docs.bridgecrew.io/docs/s3_16-enable-versioning| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
everitt-build-1
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1678303513602
| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
All S3 Buckets must have a tag with key Classification and have versioning enabled
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: 807152304871829504_AWS_1643813941482
Description
Ensure that S3 bucket have a classification tag| acl = "public-read" | ||
| force_destroy = true | ||
| # Create a bucket where objects can be public | ||
| resource "aws_s3_bucket" "public_bucket" { |
There was a problem hiding this comment.
S3 Bucket does not have public access blocks
Resource: aws_s3_bucket.public_bucket | Bridgecrew ID: BC_AWS_NETWORKING_52 | Checkov ID: CKV2_AWS_6
How to Fix
resource "aws_s3_bucket" "bucket_good_1" {
bucket = "bucket_good"
}
resource "aws_s3_bucket_public_access_block" "access_good_1" {
bucket = aws_s3_bucket.bucket_good_1.id
block_public_acls = true
block_public_policy = true
}
Description
When you create an S3 bucket, it is good practice to set the additional resource **aws_s3_bucket_public_access_block** to ensure the bucket is never accidentally public.We recommend you ensure S3 bucket has public access blocks. If the public access block is not attached it defaults to False.
No description provided.