Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #38

Merged
merged 2 commits into from
May 16, 2023
Merged

test #38

Changes from 1 commit
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
2 changes: 1 addition & 1 deletion terraform/aws/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resource "aws_s3_bucket" "data" {
# bucket is not encrypted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH  Weib Test S3
    Resource: aws_s3_bucket.data | Bridgecrew ID: 1043237819080398848_AWS_1673630255979

Description

Remove public access

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# bucket is not encrypted
resource "aws_s3_bucket" "data" {
# bucket is public
# bucket is not encrypted
# bucket does not have access logs
# bucket does not have versioning
# test update
bucket = "${local.resource_prefix.value}-data"
force_destroy = true
tags = merge({
Name = "${local.resource_prefix.value}-data"
Environment = local.resource_prefix.value
}, {
git_commit = "4d57f83ca4d3a78a44fb36d1dcf0d23983fa44f5"
git_file = "terraform/aws/s3.tf"
git_last_modified_at = "2022-05-18 07:08:06"
git_last_modified_by = "nimrod@bridgecrew.io"
git_modifiers = "34870196+LironElbaz/nimrod/nimrodkor"
git_org = "bridgecrewio"
git_repo = "terragoat"
yor_trace = "0874007d-903a-4b4c-945f-c9c233e13243"
})
}
resource "aws_s3_bucket" "data_log_bucket" {
bucket = "data-log-bucket"
}
resource "aws_s3_bucket_logging" "data" {
bucket = aws_s3_bucket.data.id
target_bucket = aws_s3_bucket.data_log_bucket.id
target_prefix = "log/"
}
MEDIUM  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

🪄 Smart Fix -

Fix based on 100% past actions in this repository

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH  Weibeler - Public S3 Buckets
    Resource: aws_s3_bucket.data | Bridgecrew ID: 1043237819080398848_AWS_1668813444422

Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot Apr 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW  AWS S3 Object Versioning is disabled
    Resource: aws_s3_bucket.data | Bridgecrew ID: BC_AWS_S3_16 | Checkov ID: CKV_AWS_21

How to Fix

resource "aws_s3_bucket" "state_bucket" {
  bucket        = "${data.aws_caller_identity.current.account_id}-terraform-state"
  acl           = var.acl
  force_destroy = var.force_destroy

+  versioning {
+    enabled    = true
+  }

  server_side_encryption_configuration {
    rule {
      apply_server_side_encryption_by_default {
        sse_algorithm = var.sse_algorithm
      }
    }
  }

  tags = var.common_tags
}

Description

S3 versioning is a managed data backup and recovery service provided by AWS. When enabled it allows users to retrieve and restore previous versions of their buckets.

S3 versioning can be used for data protection and retention scenarios such as recovering objects that have been accidentally/intentionally deleted or overwritten.

Benchmarks

  • FEDRAMP (MODERATE) CP-10, SI-12
  • PCI-DSS V3.2.1 10.5.3
     🎉   Fixed by commit e3e9f4d - update webhost

🪄 Smart Fix -

Fix based on 100% past actions in this repository

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# bucket is not encrypted
resource "aws_s3_bucket" "data" {
# bucket is public
# bucket is not encrypted
# bucket does not have access logs
# bucket does not have versioning
# test update
bucket = "${local.resource_prefix.value}-data"
force_destroy = true
tags = merge({
Name = "${local.resource_prefix.value}-data"
Environment = local.resource_prefix.value
}, {
git_commit = "4d57f83ca4d3a78a44fb36d1dcf0d23983fa44f5"
git_file = "terraform/aws/s3.tf"
git_last_modified_at = "2022-05-18 07:08:06"
git_last_modified_by = "nimrod@bridgecrew.io"
git_modifiers = "34870196+LironElbaz/nimrod/nimrodkor"
git_org = "bridgecrewio"
git_repo = "terragoat"
yor_trace = "0874007d-903a-4b4c-945f-c9c233e13243"
})
}
resource "aws_s3_bucket_versioning" "data" {
bucket = aws_s3_bucket.data.id
versioning_configuration {
status = "Enabled"
}
}
LOW  AWS S3 Object Versioning is disabled
    Resource: aws_s3_bucket.data | Bridgecrew ID: 1043237819080398848_AWS_1681219068903 | Checkov ID: CKV_AWS_21

Description

https://docs.bridgecrew.io/docs/s3_16-enable-versioning

Benchmarks

  • FEDRAMP (MODERATE) CP-10, SI-12
  • PCI-DSS V3.2.1 10.5.3

🪄 Smart Fix -

Fix based on 100% past actions in this repository

# bucket does not have access logs
# bucket does not have versioning
# test
# test update
bucket = "${local.resource_prefix.value}-data"
force_destroy = true
tags = merge({
Expand Down