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

fix(misconf): load cached tf modules #6607

Merged
merged 1 commit into from
May 4, 2024

Conversation

nikpivkin
Copy link
Contributor

@nikpivkin nikpivkin commented May 2, 2024

Description

cat main.tf
module "s3_bucket" {
  source = "terraform-aws-modules/s3-bucket/aws"

  bucket = "my-s3-bucket"
  acl    = "private"

  control_object_ownership = true
  object_ownership         = "ObjectWriter"

  versioning = {
    enabled = true
  }
}%
go run ./cmd/trivy conf ~/projects/trivy-test/issue-6603
2024-05-03T10:50:00+06:00       INFO    Detected config files   num=2
2024-05-03T10:50:00+06:00       DEBUG   Scanned config file     path="."
2024-05-03T10:50:00+06:00       DEBUG   Scanned config file     path="terraform-aws-modules/s3-bucket/aws/.terraform/modules/s3_bucket/main.tf"

terraform-aws-modules/s3-bucket/aws/.terraform/modules/s3_bucket/main.tf (terraform)

Tests: 10 (SUCCESSES: 7, FAILURES: 3, EXCEPTIONS: 0)
Failures: 3 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 2, CRITICAL: 0)

HIGH: Bucket does not have encryption enabled
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
S3 Buckets should be encrypted to protect the data that is stored within them if access is compromised.

See https://avd.aquasec.com/misconfig/avd-aws-0088
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 terraform-aws-modules/s3-bucket/aws/.terraform/modules/s3_bucket/main.tf:25-34
   via main.tf:1-13 (module.s3_bucket)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  25 ┌ resource "aws_s3_bucket" "this" {
  26 │   count = local.create_bucket ? 1 : 0
  27 │ 
  28 │   bucket        = var.bucket
  29 │   bucket_prefix = var.bucket_prefix
  30 │ 
  31 │   force_destroy       = var.force_destroy
  32 │   object_lock_enabled = var.object_lock_enabled
  33 │   tags                = var.tags
  34 └ }
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
...

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@nikpivkin nikpivkin marked this pull request as ready for review May 3, 2024 04:52
@nikpivkin nikpivkin requested a review from simar7 as a code owner May 3, 2024 04:52
@simar7 simar7 added this pull request to the merge queue May 4, 2024
Merged via the queue into aquasecurity:main with commit 7a25dad May 4, 2024
16 checks passed
fl0pp5 pushed a commit to altlinux/trivy that referenced this pull request May 6, 2024
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.

bug(misconf): terraform local cache is ignored
2 participants