Skip to content

Baseline entries do not understand same resources in different directories #7486

@jonny-graham-trade

Description

@jonny-graham-trade

Describe the issue
Using Terraform to create AWS resources.
We have multiple copies of the same resource (e.g. in both dev and prod directories). When one of these is in the baseline file, the check skips for both.
This can give the impression that a vulnerability is resolved when it is actually being suppressed by a potentially unrelated file, as removing a file from the baseline doesn't cause it to fail the check.

Examples
Create two folders in your working root. Add a main.tf in both, containing:

data "aws_iam_policy_document" "route53_policy" {
  statement {
    effect = "Allow"
    actions = [
      "route53:ListHostedZones",
      "route53:GetHostedZone",
      "route53:ListTagsForResource"
    ]
    resources = ["*"]
  }
}

run checkov --directory . --create-baseline from the root.
This will add a failure for both files into the baseline (CKV_AWS_356)

Then, delete one of the files from the baseline.

checkov -d . --baseline .checkov.baseline
My expectation is that a scan should report the failure for the file that was removed from the baseline
Instead, both failures are still suppressed.

Version (please complete the following information):

  • Tested both Checkov Version 3.2.495 and 3.2.513

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions