checkov icon indicating copy to clipboard operation
checkov copied to clipboard

checkov skips scaning files if it cannot parse file

Open harishachappa opened this issue 2 years ago • 1 comments

Describe the issue Checkov skips terraform file when it can't parse a file. When you are using checkov in gitlab ci pipeline with junitxml output, it will be better to include such erros in 'Errors' list instead of ignoring them.

Examples

resource "aws_alb" "alb" {
  name                             = "foobar-nlb"
  load_balancer_type               = "network"
  enable_cross_zone_load_balancing = true

  tags = "${merge("${var.custom_tags}", tomap({
     Name = "foobar-nlb"
  )}"
}

Version (please complete the following information):

  • 2.0.1162

harishachappa avatar Jun 06 '22 23:06 harishachappa

Hey @harishachappa ! I'm not sure about the behavior here - not everyone would like to fail the entire scan on malformed files. The current behavior takes that into account, however, we've recently added the option to fail on parsing errors - #3027 . So IMO, it would be best to add right before this line, if this option is set, an error per parsing error the report already has: https://github.com/bridgecrewio/checkov/blob/cea2c48c64b2c2528ae7ab4deb24827c06687bc5/checkov/common/output/report.py#L443

We're open to contributions here!

nimrodkor avatar Jun 07 '22 05:06 nimrodkor

Thanks for contributing to Checkov! We've automatically marked this issue as stale to keep our issues list tidy, because it has not had any activity for 6 months. It will be closed in 14 days if no further activity occurs. Commenting on this issue will remove the stale tag. If you want to talk through the issue or help us understand the priority and context, feel free to add a comment or join us in the Checkov slack channel at https://slack.bridgecrew.io Thanks!

stale[bot] avatar Dec 04 '22 14:12 stale[bot]

Closing issue due to inactivity. If you feel this is in error, please re-open, or reach out to the community via slack: https://slack.bridgecrew.io Thanks!

stale[bot] avatar Dec 18 '22 15:12 stale[bot]