fix(misconf): respect .yml files when Helm charts are detected (#9912)

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
Nikita Pivkin
2025-12-10 05:07:39 +06:00
committed by GitHub
parent 56b59e8abb
commit 18ecf75176
3 changed files with 8 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ Trivy scans Infrastructure as Code (IaC) files for
| [Terraform Plan](terraform.md) | tfplan, \*.tfplan, \*.json | | [Terraform Plan](terraform.md) | tfplan, \*.tfplan, \*.json |
| [CloudFormation](cloudformation.md) | \*.yml, \*.yaml, \*.json | | [CloudFormation](cloudformation.md) | \*.yml, \*.yaml, \*.json |
| [Azure ARM Template](azure-arm.md) | \*.json | | [Azure ARM Template](azure-arm.md) | \*.json |
| [Helm](helm.md) | \*.yaml, \*.tpl, \*.tar.gz, etc. | | [Helm](helm.md) | \*.yml, \*.yaml, \*.tpl, \*.tar.gz, etc. |
| [YAML][json-and-yaml] | \*.yaml, \*.yml | | [YAML][json-and-yaml] | \*.yaml, \*.yml |
| [JSON][json-and-yaml] | \*.json | | [JSON][json-and-yaml] | \*.json |
| [Ansible](ansible.md) | \*.yml, \*.yaml, \*.json, \*.ini, without extension | | [Ansible](ansible.md) | \*.yml, \*.yaml, \*.json, \*.ini, without extension |

View File

@@ -193,7 +193,7 @@ func init() {
return true return true
} }
} }
helmFileExtensions := []string{".yaml", ".tpl"} helmFileExtensions := []string{".yml", ".yaml", ".tpl"}
ext := filepath.Ext(filepath.Base(name)) ext := filepath.Ext(filepath.Base(name))
for _, expected := range helmFileExtensions { for _, expected := range helmFileExtensions {
if strings.EqualFold(ext, expected) { if strings.EqualFold(ext, expected) {

View File

@@ -246,6 +246,7 @@ Resources:
r: nil, r: nil,
expected: []FileType{ expected: []FileType{
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
FileTypeAnsible, FileTypeAnsible,
}, },
}, },
@@ -276,6 +277,7 @@ spec:
expected: []FileType{ expected: []FileType{
FileTypeKubernetes, FileTypeKubernetes,
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
FileTypeAnsible, FileTypeAnsible,
}, },
}, },
@@ -342,6 +344,7 @@ spec:
r: nil, r: nil,
expected: []FileType{ expected: []FileType{
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
FileTypeAnsible, FileTypeAnsible,
}, },
}, },
@@ -351,6 +354,7 @@ spec:
r: nil, r: nil,
expected: []FileType{ expected: []FileType{
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
}, },
}, },
{ {
@@ -384,6 +388,7 @@ data:
expected: []FileType{ expected: []FileType{
FileTypeKubernetes, FileTypeKubernetes,
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
FileTypeAnsible, FileTypeAnsible,
}, },
}, },
@@ -413,6 +418,7 @@ rules:
expected: []FileType{ expected: []FileType{
FileTypeKubernetes, FileTypeKubernetes,
FileTypeYAML, FileTypeYAML,
FileTypeHelm,
FileTypeAnsible, FileTypeAnsible,
}, },
}, },