-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
[3rd party: checkov] Checkov runs for all files, not just .tf #284
Comments
Could you please provide a snippet from the execution output to demonstrate details? Along with As far as you can see from https://github.com/antonbabenko/pre-commit-terraform#checkov, this hook's
I lean to think that's the expected behavior for the defaults of |
I have posted the full Here is the command I execute and the output:
I did manage to work around this by updating the repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.56.0
hooks:
- id: checkov
args:
- --skip-path
- .*(?<!terraform\/)$
# - .*(?<!\.tf)$ # something like this can also do the trick This is okay in my case, it was just not intuitive at first. I would expect it to not scan the Dockefile, or really anything but the P.S. I don't believe you can pass the From pre-commit docs:
|
Good to know you've worked around this.
Since the Should we close this issue at this point? |
Yup, that also makes sense. The confusion came from the fact that the rest of the terraform hooks seem to respect the Thanks for the quick responses! |
Can this be reopened to allow the -d flag to be passed to checkov? This looks like a workaround since, as @mj3c mentioned, the -d flag currently cannot be overridden. |
@entscheidungsproblem did you try to override it using the example in https://github.com/antonbabenko/pre-commit-terraform#checkov ? If not, #290 should add that possibility |
Hi @MaxymVlasov, yes I did try to override it like the example you shared. I have a monorepo with my application code in one directory and my terraform code in another directory but checkov still runs everywhere.
Let me know if I can provide more details, otherwise I'll follow #290, thanks! |
Describe the bug
I have a problem with the
checkov
hook running against the entire repo, checking all files, instead of only.tf
files and specifically a subdirectory of them. For example, if you have this:And if you run
pre-commit run -a
, checkov will fail at any Dockerfile errors.How can we reproduce it?
Dockerfile example that will fail checkov:
FROM ubuntu:18.04
Pre-commit config:
Environment information
uname -a
and/orsysteminfo | Select-String "^OS"
output:Linux 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Additional information
I believe this is because of the following setting for the checkov hook:
Even though
files:
is set, checkov still seems to check all files. The checkov CLI supports regex in the--skip-path
argument, so perhaps this can be resolved with something like the following?The text was updated successfully, but these errors were encountered: