Files
codebase-memory-mcp/tests/fixtures/complexity
Martin Vogel 4cea54f758 fix(deploy): bound Helm rendering on hostile input, no partial or wrong release images
Review round 1 of #2677. Every case ends in an explicit unknown, never in a
hang, an OOM, a partial or a wrong image.

Bounds (helm_template.c):
- A per-render step and output budget (10,000,000 steps, 64 MiB): a range
  over a huge int, a huge indent, defines that include each other in a fan
  stop the render; every probe of the template is UNKNOWN, also one captured
  before, and the trip is logged (helm.render.budget). Counted, never timed.
  On the 20 infra corpora no render reaches it.
- go-yaml v2's alias limit: values whose decodes are mostly alias expansion
  (a billion laughs) do not parse, as in Helm.
- --set: an index past strvals' MaxIndex (65536) or a key longer than the
  parser holds is no value (the release is unknown), never a padded list or
  a split key.

Reads (pass_k8s.c, pass_terraform.c): a values file, Chart.yaml, kustomize
valuesFile or Terraform file() named by path is read only when it is a
discovered file of the repository -- never through a symlink out of it --
with the size cap and tree-sitter padding of every other read. A chart file
that is there but not read makes the chart's values unknown, not empty.

Wrong images:
- Terraform number sets reach the chart as Terraform's exact decimal
  (1.10 -> "1.1"), not %.17g.
- A release with a value source not read -- Flux valuesFrom, valuesFiles,
  postRenderers; kustomize additionalValuesFiles, a valuesMerge other than
  override, a valuesFile not read; Terraform dynamic "set" -- has no image of
  its own.
- An aliased subchart renders with .Chart.Name its alias.
- An UNKNOWN if / with / range makes what its bodies assign UNKNOWN and
  leaves the loop a break in them would; set / unset / merge poison the map
  they change (merge: the maps within too). A change that may reach values
  another part holds taints every later capture; one of a new value
  (fromYaml, deepCopy, an empty dict, a part of one) does not.

Marks and secrets:
- The chart edge reads default_of as JSON (list paths kept), builds its
  properties to size, and writes no edge whose mark it could not carry whole.
- Build arguments with a secret (by name or value) are never kept; build
  edge properties and values-path marks are never cut.

Tests: one per bound and per wrong-image case, each RED on d21949ef by its
assertion; a Helm chart joins the Kubernetes complexity fixture.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-18 21:08:20 +02:00
..