Skip to content
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

feat(helm): add support for kubeVersion #6337

Closed
2 tasks done
nikpivkin opened this issue Mar 18, 2024 Discussed in #5919 · 0 comments
Closed
2 tasks done

feat(helm): add support for kubeVersion #6337

nikpivkin opened this issue Mar 18, 2024 Discussed in #5919 · 0 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Milestone

Comments

@nikpivkin
Copy link
Contributor

https://helm.sh/docs/helm/helm_template/

Discussed in #5919

Originally posted by a-devops-guy January 11, 2024

Description

Trivy is detecting 0 files when performing scan if tpllib is used to generate set of resources like deployment, services etc
yaml renders works just fine as well as helm install

happy to provide more example or our full helm library on request.

Desired Behavior

trivy should scan helm chart even when chart is highly templated. scanning the templated yaml file using helm template works fine

Actual Behavior

trivy should scan detects 0 files when helm chart is highly templated.

Reproduction Steps

  1. create a helm chart helm create test
  2. remove all files in template folder
  3. add file _helper.tpl
{{- define "deployment" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "tpl.resource.name" . }}
  labels: {{- include "tpl.labels" . | nindent 4 }}
{{- end -}}
  1. add file deployment.yaml
{{- include "deployment" . }}
spec:
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: myapp
        image: test:latest
        resources:
          limits:
            memory: "128Mi"
            cpu: "500m"
        ports:
        - containerPort: 80
  1. perform trivy scan trivy config . --debug
2024-01-11T12:03:01.878+0530    DEBUG   Severities: ["UNKNOWN" "LOW" "MEDIUM" "HIGH" "CRITICAL"]
2024-01-11T12:03:01.961+0530    DEBUG   cache dir:  /Users/kiran/Library/Caches/trivy
2024-01-11T12:03:01.961+0530    INFO    Misconfiguration scanning is enabled
2024-01-11T12:03:01.961+0530    DEBUG   Failed to open the policy metadata: open /Users/kiran/Library/Caches/trivy/policy/metadata.json: no such file or directory
2024-01-11T12:03:01.961+0530    INFO    Need to update the built-in policies
2024-01-11T12:03:01.961+0530    INFO    Downloading the built-in policies...
2024-01-11T12:03:01.961+0530    DEBUG   Using URL: ghcr.io/aquasecurity/trivy-policies:0 to load policy bundle
44.78 KiB / 44.78 KiB [--------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% ? p/s 100ms
2024-01-11T12:03:04.637+0530    DEBUG   Digest of the built-in policies: sha256:8bfc31f3e4301ef758b6793a07e0b12b4306e0b54d03a640efb2ff5e5ef29b9e
2024-01-11T12:03:04.637+0530    DEBUG   Policies successfully loaded from disk
2024-01-11T12:03:04.637+0530    DEBUG   Enabling misconfiguration scanners: [azure-arm cloudformation dockerfile helm kubernetes terraform terraformplan]
2024-01-11T12:03:04.678+0530    DEBUG   The nuget packages directory couldn't be found. License search disabled
2024-01-11T12:03:04.678+0530    DEBUG   Walk the file tree rooted at '.' in series
2024-01-11T12:03:04.686+0530    DEBUG   Scanning Helm files for misconfigurations...
2024-01-11T12:03:04.772+0530    DEBUG   OS is not detected.
2024-01-11T12:03:04.772+0530    INFO    Detected config files: 0

Target

None

Scanner

None

Output Format

None

Mode

None

Debug Output

Operating System

Mac sonoma, Redhat ubi9 container image

Version

0.48.2

Checklist

@nikpivkin nikpivkin added kind/bug Categorizes issue or PR as related to a bug. scan/misconfiguration Issues relating to misconfiguration scanning labels Mar 18, 2024
@nikpivkin nikpivkin added kind/feature Categorizes issue or PR as related to a new feature. and removed kind/bug Categorizes issue or PR as related to a bug. labels Mar 19, 2024
@simar7 simar7 added this to the v0.51.0 milestone Mar 26, 2024
@simar7 simar7 self-assigned this Apr 4, 2024
@simar7 simar7 closed this as completed Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Projects
Archived in project
Development

No branches or pull requests

2 participants