feat(terraform): hyphen and non-ASCII support for domain names in credential extraction #6068
Closed
2 tasks done
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
scan/misconfiguration
Issues relating to misconfiguration scanning
Milestone
Discussed in #6067
Originally posted by adam-carruthers February 5, 2024
Description
Here is the trivy code that finds the token for private terraform registry modules:
https://github.com/aquasecurity/trivy-iac/blob/3d8e412cf0ab0c8ad0296df8a01363a3ed7efe85/pkg/scanners/terraform/parser/resolvers/registry.go#L58
This correctly changes the
.
characters in hostnames to_
- but that's not the only transformation that needs to be done. It also needs to look for a second env var with the-
characters as__
. From the terraform docs:I really need this change, because I pass the token through the
TF_TOKEN
variable, but the hostname has a-
and I am using Ubuntu that doesn't allow-
in environment variables, so trivy can't find myDesired Behavior
When I used my environment variable
TF_TOKEN_some__site_with_hash_com
trivy recognised it as the terraform private registry token forsome-site.with.hash.com
Actual Behavior
Trivy didn't recognise my environment variable and I couldn't connect it to the private registry.
Reproduction Steps
export TF_TOKEN_some__site_with_hash_com=abcdef
trivy config --skip-dirs .terraform -d .
Target
Filesystem
Scanner
Misconfiguration
Output Format
None
Mode
Standalone
Debug Output
Operating System
Ubuntu
Version
Checklist
trivy image --reset
The text was updated successfully, but these errors were encountered: