Skip to content

fix: quote/int-cast user values to prevent YAML injection - #37

Merged
ddecrulle merged 2 commits into
mainfrom
fix/yaml-injection-quote-values
Oct 26, 2026
Merged

ddecrulle merged 2 commits into
mainfrom
fix/yaml-injection-quote-values

Conversation

@ddecrulle

Copy link
Copy Markdown
Member

Problem

Onyxia fills chart values from user input and installs the chart as cluster-admin. Values interpolated without quoting can break out of their YAML scalar: a value with newlines and --- injects arbitrary manifests (e.g. a ClusterRoleBinding to cluster-admin). Same class of bug as InseeFrLab/helm-charts-interactive-services#332, InseeFrLab/helm-charts-databases#188 and InseeFrLab/helm-charts-automation#131.

An audit rendering every free-text schema field with such a payload found 2 injectable fields in this repo's own templates and 4 more through the Bitnami postgresql subchart.

Fix

  • Own templates: | quote, | int (ports, replicas), printf … | quote for metabase's repo:tag image.
  • global.postgresql.auth.username / database (metabase, redash), consumed by the Bitnami postgresql subchart: single-line pattern (^[^\n\r]*$) in values.schema.json, so helm rejects the value before rendering.

Regression test

utils/test_yaml_injection.py + .github/workflows/yaml-injection-test.yaml (same script as helm-charts-interactive-services): tests the charts changed by a PR / push to main, all charts on workflow_dispatch.

Verification

  • Injection test: 3/3 charts safe.
  • Default renders compared object by object before/after: unchanged (only randomly generated secrets differ between renders).
  • helm lint passes; versions bumped.

Limits

The pattern protection relies on helm's schema validation at install time; keys passed beyond the form (e.g. Bitnami extraDeploy) need least privilege for the installing identity.

🤖 Generated with Claude Code

ddecrulle and others added 2 commits October 23, 2026 15:57
Onyxia fills chart values from user input and installs the chart as
cluster-admin. Values interpolated unquoted (or wrapped only in literal quotes)
could break out of their YAML scalar and inject arbitrary manifests.

- Own templates: `| quote`, `| int` for ports/replicas, `printf ... | quote`
  for metabase's `repo:tag` image.
- Fields consumed by the Bitnami postgresql subchart (metabase, redash): a
  single-line `pattern` in values.schema.json, enforced by helm's schema
  validation before rendering.

Default renders are unchanged (compared object by object; only randomly
generated secrets differ between renders).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
utils/test_yaml_injection.py renders each chart with a `\n---` payload in every
free-text schema field (feature flags of the field's parents switched on) and
fails if a value breaks the rendered YAML or injects a document. Same script as
helm-charts-interactive-services.

The workflow tests the charts changed by a pull request or a push to main, and
all charts on workflow_dispatch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ddecrulle
ddecrulle merged commit 4ef5636 into main Oct 26, 2026
1 check passed
@ddecrulle
ddecrulle deleted the fix/yaml-injection-quote-values branch October 26, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant