Skip to content

Removed Yor tags#10

Open
bmppa wants to merge 3 commits into
mainfrom
S3
Open

Removed Yor tags#10
bmppa wants to merge 3 commits into
mainfrom
S3

Conversation

@bmppa
Copy link
Copy Markdown
Owner

@bmppa bmppa commented Apr 22, 2022

No description provided.

Copy link
Copy Markdown

@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.

Prisma Cloud has found configuration errors in this PR ⬇️

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW   AWS resources that support tags do not have Tags
    Resource: aws_s3_bucket.data | ID: BC_AWS_GENERAL_26

How to Fix

resource "aws_security_group" "sg" {
  name = "my-sg"
  ...
+ tags = {
+   Environment = "dev"
+   Owner = "apps-team"
+ }
}

Description

Many different types of AWS resources support tags. Tags allow you to add metadata to a resource to help identify ownership, perform cost / billing analysis, and to enrich a resource with other valuable information, such as descriptions and environment names. While there are many ways that tags can be used, we recommend you follow a tagging practice.

View AWS's recommended tagging best practices here.

Dependent Resources



Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
}
}
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
}
LOW   AWS Access logging not enabled on S3 buckets
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_13

Description

Access logging provides detailed audit logging for all objects and folders in an S3 bucket.

Benchmarks

  • HIPAA 164.312(B) Audit controls
Dependent Resources

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
}
}
resource "aws_s3_bucket_versioning" "data" {
bucket = aws_s3_bucket.data.id
versioning_configuration {
status = "Enabled"
}
HIGH   AWS S3 Object Versioning is disabled
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_16

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

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

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

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"
}

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
Dependent Resources

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HIGH   Check that all resources are tagged with the key - env
    Resource: aws_s3_bucket.data | ID: 807152304871829504_AWS_1641845546823
Dependent Resources

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HIGH   terraform build demo
    Resource: aws_s3_bucket.data | ID: 807152304871829504_AWS_1643881781204
Dependent Resources

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW   S3 bucket cross-region replication disabled
    Resource: aws_s3_bucket.data | ID: BC_AWS_GENERAL_72

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.

Dependent Resources



Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW   S3 buckets are not encrypted with KMS
    Resource: aws_s3_bucket.data | ID: BC_AWS_GENERAL_56

How to Fix

resource "aws_s3_bucket" "mybucket" {
  ...
  server_side_encryption_configuration {
    rule {
      apply_server_side_encryption_by_default {
        kms_master_key_id = aws_kms_key.mykey.arn
 +      sse_algorithm     = "aws:kms"
      }
    }
  }
}

Description

TBA

Dependent Resources



Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW   S3 Bucket does not have public access blocks
    Resource: aws_s3_bucket.data | ID: BC_AWS_NETWORKING_52

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.

Dependent Resources



Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "data" {
bucket = aws_s3_bucket.data.bucket
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
HIGH   AWS S3 buckets do not have server side encryption
    Resource: aws_s3_bucket.data | ID: BC_AWS_S3_14

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

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

Calculating...

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

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 | Policy ID: 807152304871829504_AWS_1670654004846 | Checkov ID: CKV_AWS_20

Description

https://docs.bridgecrew.io/docs/s3_1-acl-read-permissions-everyone

Benchmarks

  • NIST-800-53 AC-17

Comment thread terraform/aws/s3.tf
git_repo = "iac-demo"
yor_trace = "8cebc6f3-14b0-4a60-bd65-7988a2c206f1"
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
}
}
resource "aws_s3_bucket_versioning" "data" {
bucket = aws_s3_bucket.data.id
versioning_configuration {
status = "Enabled"
}
}
HIGH   AWS S3 Object Versioning is disabled
    Resource: aws_s3_bucket.data | Policy ID: 807152304871829504_AWS_1658427621485 | Checkov ID: CKV_AWS_21

Description

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

Copy link
Copy Markdown

@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 8a5b92b - Update s3.tf - 2 new errors were added and 4 errors were fixed.

Change details

Error ID Change Path Resource
807152304871829504_AWS_1670654004846 Added /terraform/aws/s3.tf aws_s3_bucket.data
807152304871829504_AWS_1658427621485 Added /terraform/aws/s3.tf aws_s3_bucket.data
BC_AWS_S3_16 Fixed /terraform/aws/s3.tf aws_s3_bucket.data
807152304871829504_AWS_1643813941482 Fixed /terraform/aws/s3.tf aws_s3_bucket.data
BC_AWS_S3_1 Fixed /terraform/aws/s3.tf aws_s3_bucket.data
807152304871829504_AWS_1649178060477 Fixed /terraform/aws/s3.tf aws_s3_bucket.data

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.

1 participant