feat(misconf): Support symlinks in misconfiguration scanning #7456
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
scan/misconfiguration
Issues relating to misconfiguration scanning
This is part of a bigger discussion as to if Trivy should support on a global scanner level or not as seen here: #4184
Discussed in #7419
Originally posted by h-l-b August 29, 2024
Question
We are migrating from tfsec to trivy and trivy is not scanning most of the nested terraform modules in one of our projects - the number of config files detected is fewer than expected and expected misconfigurations are not flagged. The reason for this seems to be that they are called in a loop based on a variable defined in a symlinked file (simplified version of our project structure below)
main.tf in root module
virtual_environments is defined in the variables file, which is actually a symlink from the root module directory
variables.tf -> ../../shared/variables.tf
The actual value for virtual_environments for an environment is in a tfvars file which is passed in as an argument to the trivy config command.
If I replace the symlink to variables.tf with an actual variables.tf file with exactly the same content, then the number of config files detected is greater and ../../modules/0_network is actually scanned, so it looks like it is the symlink that is causing the issue. We use the symlink to a shared file because we have multiple layers in the project which use the same variables, so this way we only have to update them in one place. tfsec works fine with this.
I've found #4184 which says that symlinks are not supported, but it's from last year and was wondering if it is still the case, and if there are any plans to add support?
Target
Filesystem
Scanner
Misconfiguration
Output Format
None
Mode
None
Operating System
macOS Sonoma
Version
The text was updated successfully, but these errors were encountered: