|
| 1 | +# Helm |
| 2 | +Trivy supports two types of Helm scanning, templates and packaged charts. |
| 3 | +The following scanners are supported. |
| 4 | + |
| 5 | +| Format | [Misconfiguration] | [Secret] | |
| 6 | +| -------- | :----------------: | :------: | |
| 7 | +| Template | ✓ | ✓ | |
| 8 | +| Chart | ✓ | - | |
| 9 | + |
| 10 | +## Misconfiguration |
| 11 | +Trivy recursively searches directories and scans all found Helm files. |
| 12 | + |
| 13 | +It evaluates variables, functions, and other elements within Helm templates and resolve the chart to Kubernetes manifests then run the Kubernetes checks. |
| 14 | +See [here](../../scanner/misconfiguration/policy/builtin.md) for more details on the built-in policies. |
| 15 | + |
| 16 | +### Value overrides |
| 17 | +There are a number of options for overriding values in Helm charts. |
| 18 | +When override values are passed to the Helm scanner, the values will be used during the Manifest rendering process and will become part of the scanned artifact. |
| 19 | + |
| 20 | +#### Setting inline value overrides |
| 21 | +Overrides can be set inline on the command line |
| 22 | + |
| 23 | +```bash |
| 24 | +trivy conf --helm-set securityContext.runAsUser=0 ./charts/mySql |
| 25 | +``` |
| 26 | + |
| 27 | +#### Setting value file overrides |
| 28 | +Overrides can be in a file that has the key=value set. |
| 29 | + |
| 30 | +```yaml |
| 31 | +# Example override file (overrides.yaml) |
| 32 | + |
| 33 | +securityContext: |
| 34 | + runAsUser: 0 |
| 35 | +``` |
| 36 | +
|
| 37 | +```bash |
| 38 | +trivy conf --helm-values overrides.yaml ./charts/mySql |
| 39 | +``` |
| 40 | + |
| 41 | +#### Setting value as explicit string |
| 42 | +the `--helm-set-string` is the same as `--helm-set` but explicitly retains the value as a string |
| 43 | + |
| 44 | +```bash |
| 45 | +trivy config --helm-set-string name=false ./infrastructure/tf |
| 46 | +``` |
| 47 | + |
| 48 | +#### Setting specific values from files |
| 49 | +Specific override values can come from specific files |
| 50 | + |
| 51 | +```bash |
| 52 | +trivy conf --helm-set-file environment=dev.values.yaml ./charts/mySql |
| 53 | +``` |
| 54 | + |
| 55 | +## Secret |
| 56 | +The secret scan is performed on plain text files, with no special treatment for Helm. |
| 57 | +Secret scanning is not conducted on the contents of packaged Charts, such as tar or tar.gz. |
| 58 | + |
| 59 | +[Misconfiguration]: ../../scanner/misconfiguration/index.md |
| 60 | +[Secret]: ../../scanner/secret.md |
0 commit comments