Helm Pack
URL slug: helm
This page is for engineers reviewing Helm chart changes with OpenTremor. It explains which changed files the pack reads, how it creates analysis units, and how it reports unresolved template references.
Files it reads
Section titled “Files it reads”| File | Read as |
|---|---|
A file named Chart.yaml | Chart metadata |
A file whose name matches *values*.yaml, such as values-prod.yaml | Values file |
A .yaml, .yml, or .tpl file under a templates/ directory | Template |
NOTES.txt under a templates/ directory | Template: the text Helm prints after an install |
A file under templates/ is a template even when its name contains values.
The pack does not implement sniff(). It reads diffs only. Other packs also read bare values files as YAML.
parse_diff (opentremor_pack_helm/parser.py) reads the diff with core’s iter_hunks (opentremor_core.libs.diff) and produces three kinds of unit.
values: one changed top-level key
Section titled “values: one changed top-level key”Core’s iter_yaml_blocks (opentremor_core.libs.yaml_diff) finds the key path of each changed line. The pack groups changed blocks by top-level key, such as image or podSecurityContext, and keeps each group as a contiguous slice of the hunk so removed and added lines stay side by side. A @@ <key> @@ line names each slice. Multiple hunks for the same key in the same file produce one unit.
After the key’s lines, the unit includes template blocks in the same diff that read .Values.<key>, under ## Templates in this diff that read .Values.<key>. The pack matches .Values.<key>, $.Values.<key>, and index .Values "<key>". It does not follow a variable that holds .Values.
template: one changed template block
Section titled “template: one changed template block”A template is a Go template, not YAML, so the pack splits it itself (templates.py):
- A block opens at a line that starts in column 0 while no template action is open: a YAML key (
spec:) or an action ({{- if .Values.rbac.create }},{{- define "web.labels" }}). - In a
.tplhelper file, onlydefineopens a block. - An
if,range,with,define, orblockaction keeps its block open until the matchingend. - A
---line in column 0 closes the open block. - Lines above the first block of a hunk form one block, named after git’s section heading.
Only blocks with a + or - line become units. Unchanged blocks can still count as readers of a values key.
| Block opens with | name |
|---|---|
spec: | spec |
{{- if .Values.rbac.create }} | if .Values.rbac.create |
{{- define "web.fullname" -}} | define "web.fullname" |
A hunk that starts inside spec: | spec, from git’s heading |
chart: one changed top-level key of Chart.yaml
Section titled “chart: one changed top-level key of Chart.yaml”Chart units are grouped like values units. When the hunk shows the key’s own line, the slice starts there, so a new dependency includes the dependencies already listed.
Unresolved references
Section titled “Unresolved references”A values or template unit can end with a list of references that the diff does not resolve:
## Template references this diff does not resolve* .Values.image.tag: its default is not changed in this diff* template "web.labels": its define is not in this diff| Unit | Listed when |
|---|---|
template | It reads .Values.<key> and no values file in the diff changes that top-level key |
template | It calls include or template with a name that the diff does not define |
values | No template in the diff reads the key |
The ruleset requires every finding on a values or template unit to copy unresolved references into its consequence and use LOW confidence. If there are no unresolved references, the finding must say so. The confidence listed by a rule applies to chart units only.
Unit shape
Section titled “Unit shape”{ "hash": "<sha256 of the normalised body>", "type": "values", "name": "podSecurityContext", "action": "modify", "body": "@@ podSecurityContext @@\n podSecurityContext:\n- runAsNonRoot: true\n+ runAsNonRoot: false\n...", "metadata": { "generated_at_utc": "2026-10-26T10:30:00Z", "source_path": "charts/orders/values.yaml", "group_path": null }}action comes from the unit’s own lines, not from templates attached to it.
Rulesets
Section titled “Rulesets”| File | Served at |
|---|---|
helm-rules.md | GET /v1/helm/rules |
| Rule ID | Area | What it catches |
|---|---|---|
| HELM-001 | Security | Values that remove or empty securityContext or podSecurityContext, turn off runAsNonRoot or readOnlyRootFilesystem, enable allowPrivilegeEscalation or privileged, or turn off networkPolicy.enabled |
| HELM-002 | Supply chain | An image built from values with a tag but no digest option |
| HELM-003 | Security | RBAC with * verbs, resources, or API groups, or get, list, or watch access to secrets |
| HELM-004 | Secrets | A secret value in a ConfigMap data entry, an annotation, or NOTES.txt |
| HELM-005 | Supply chain | A Chart.yaml dependency without a pinned version or from a repository the chart did not use before |
| HELM-PERF-001 to -004 | Performance | Resource defaults removed, an HPA without CPU requests, a large default maxSurge, or Always pull for a digest-pinned image |
| HELM-REL-001, -002 | Reliability | Probes or the PodDisruptionBudget off by default, or one replica paired with minAvailable: 1 |
Performance and reliability findings are LOW or MEDIUM confidence. They do not fail the merge check on their own. Core keeps an organization’s unedited rows in step with this file (OpenTremor-core#0034).
Worked example
Section titled “Worked example”diff --git a/charts/orders/values.yaml b/charts/orders/values.yaml--- a/charts/orders/values.yaml+++ b/charts/orders/values.yaml@@ -20,4 +20,4 @@ serviceAccount: podSecurityContext:- runAsNonRoot: true+ runAsNonRoot: falsediff --git a/charts/orders/templates/deployment.yaml b/charts/orders/templates/deployment.yaml--- a/charts/orders/templates/deployment.yaml+++ b/charts/orders/templates/deployment.yaml@@ -18,3 +18,5 @@ spec: spec:+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }} containers:The diff produces two units:
- A
valuesunit forpodSecurityContext, with the deployment block attached because it reads that key. Nothing is unresolved. The model reports HELM-001 with LOW confidence because the changed default setsrunAsNonRootto false. - A
templateunit namedspec, with actionadd. Its.Values.podSecurityContextreference is resolved because the diff changes that top-level values key.
The pack’s demo sample (demo/input.txt) contains a fuller chart change: a root security context, a wildcard Role, the PodDisruptionBudget turned off, and an unpinned dependency.