question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

checkov directory switch not repeatable

See original GitHub issue

Describe the bug When running checkov -h, the directory switch claims it is repeatable but when you repeat it, only the last directory listed is scanned

  -d DIRECTORY, --directory DIRECTORY
                        Terraform root directory (can not be used together with --file). Can be repeated

To Reproduce Steps to reproduce the behavior:

  1. Create two directories (directory1, directory2) containing valid terraform files
  2. Run cli command checkov -d ./directory1 -d ./directory2
  3. Only directory2 is scanned

Expected behavior Both directory1 and directory2 are scanned

Desktop (please complete the following information):

  • Checkov Version: 1.0.180

Additional context I would actually prefer a recursive switch, using the -d directive multiple times is a workaround

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
metahertzcommented, Oct 15, 2020

I’m potentially missing something here, but with talk of an -r flag, checkov’s behaviour is recursive for -d anyway;

Given a directory with the following layout:

➜  terraform git:(master) ls -la
total 0
drwxr-xr-x   5 matt  staff  160  7 Oct 16:41 .
drwxr-xr-x   9 matt  staff  288  7 Oct 16:41 ..
drwxr-xr-x  16 matt  staff  512  7 Oct 16:41 aws
drwxr-xr-x  17 matt  staff  544  7 Oct 16:41 azure
drwxr-xr-x   9 matt  staff  288  7 Oct 16:41 gcp
➜  terraform git:(master) ls

Checkov will return results from all three, this is from the terragoat project under ./terraform https://github.com/bridgecrewio/terragoat/tree/master/terraform

Does that not solve the original issue of needing to scan multiple directories?

0reactions
stale[bot]commented, Jun 7, 2021

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: Check results are reported twice #80
When using checkov github action, check results are reported twice. This issue is reproducible every time. version: 2.0.977 *edit detailed ...
Read more >
Multiple --file options given results in duplicate findings (#911) · ...
Checkov Version 1.0.726; Ubuntu. This is in the same ballpark as #115, checkov directory switch not repeatable , but a different kind of...
Read more >
New in Checkov: Support multiple development and ...
If --config-file is not set, Checkov will search the specified directory, working directory, or home directory for .checkov.yaml .
Read more >
CLI Command Reference
Runs checks but always returns a 0 exit code. Using either –soft-fail-on and / or –hard-fail-on overrides this option, except for the case...
Read more >
Chekov v1.1 Release Notes
You should see your new list set in the table. At this point you can create another set by repeating steps 3 –...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found