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

Terragaot local #13

Merged
merged 6 commits into from
Feb 25, 2023
Merged

Terragaot local #13

merged 6 commits into from
Feb 25, 2023

Conversation

Winston1234567
Copy link
Owner

No description provided.

@@ -4,7 +4,6 @@ resource "aws_s3_bucket" "data" {
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
acl = "public-read"
force_destroy = true

Choose a reason for hiding this comment

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

LOW   AWS S3 buckets do not have server side encryption
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_14

How to Fix

resource "aws_s3_bucket" "example" {
  ...
+ server_side_encryption_configuration {
+ 	rule {
+    	apply_server_side_encryption_by_default {
+      	sse_algorithm = "AES256"
+   	}
+ 	}
+	}
}

Description

SSE helps prevent unauthorized access to S3 buckets. Encrypting and decrypting data at the S3 bucket level is transparent to users when accessing data.

Benchmarks

  • FEDRAMP (MODERATE) SC-28
  • CIS AWS V1.3 2.1.1
  • NIST-800-53 SC-2, AC-17
  • PCI-DSS V3.2 3
  • PCI-DSS V3.2.1 3.4

@@ -4,7 +4,6 @@ resource "aws_s3_bucket" "data" {
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
acl = "public-read"
force_destroy = true
Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot Nov 27, 2022

Choose a reason for hiding this comment

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

HIGH   AWS S3 bucket ACL grants READ permission to everyone
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_1

How to Fix

resource "aws_s3_bucket" "data" {
	...
  bucket        = "${local.resource_prefix.value}-data"
-  acl           = "public-read"
+  acl           = "private"
}

Description

Unprotected S3 buckets are one of the major causes of data theft and intrusions. An S3 bucket that allows **READ** access to everyone can provide attackers the ability to read object data within the bucket, which can lead to the exposure of sensitive data. The only S3 buckets that should be globally accessible for unauthenticated users or for **Any AWS Authenticate Users** are those used for hosting static websites. Bucket ACL helps manage access to S3 bucket data.

We recommend AWS S3 buckets are not publicly accessible for READ actions to protect S3 data from unauthorized users and exposing sensitive data to public access.

Benchmarks

  • NIST-800-53 AC-17

🎉   Fixed by commit 5d4ec9c - new

@@ -4,7 +4,6 @@ resource "aws_s3_bucket" "data" {
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
acl = "public-read"
force_destroy = true
Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot Nov 27, 2022

Choose a reason for hiding this comment

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

HIGH   AWS S3 Bucket has an ACL defined which allows public WRITE access
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_2

How to Fix

Type: AWS::S3::Bucket
    Properties:
    	...
-     AccessControl: PublicReadWrite

Description

Unprotected S3 buckets are one of the major causes of data theft and intrusions. An S3 bucket that allows **WRITE** access to everyone allows attackers to create, overwrite and delete objects within the bucket, which can lead to: S3 data loss, unintended changes to applications using that bucket, and unexpected charges. The only S3 buckets that should be globally accessible for unauthenticated users or for **Any AWS Authenticate Users** are those used for hosting static websites. Bucket ACL helps manage access to S3 bucket data.

We recommend AWS S3 buckets are not publicly accessible for WRITE actions to protect S3 data from unauthorized users and exposing sensitive data to public access.

Benchmarks

  • NIST-800-53 AC-17

🎉   Fixed by commit 5d4ec9c - new

@@ -4,7 +4,6 @@ resource "aws_s3_bucket" "data" {
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
acl = "public-read"
force_destroy = true
Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot Nov 27, 2022

Choose a reason for hiding this comment

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

MEDIUM   AWS Access logging not enabled on S3 buckets
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_13

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

🎉   Fixed by commit 5d4ec9c - new

Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot left a comment

Choose a reason for hiding this comment

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

⚠️   Due to 5d4ec9c - new - 3 errors were fixed.

Change details

Error ID Change Path Resource
BC_AWS_S3_13 Fixed /s3.tf aws_s3_bucket.data
BC_AWS_S3_1 Fixed /s3.tf aws_s3_bucket.data
BC_AWS_S3_2 Fixed /s3.tf aws_s3_bucket.data

@Winston1234567 Winston1234567 merged commit 96d41fe into master Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants