Repository navigation
fix: quote/int-cast user values to prevent YAML injection - #37
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. aClusterRoleBindingtocluster-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
| quote,| int(ports, replicas),printf … | quotefor metabase'srepo:tagimage.global.postgresql.auth.username/database(metabase, redash), consumed by the Bitnami postgresql subchart: single-linepattern(^[^\n\r]*$) invalues.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 onworkflow_dispatch.Verification
helm lintpasses; versions bumped.Limits
The
patternprotection relies on helm's schema validation at install time; keys passed beyond the form (e.g. BitnamiextraDeploy) need least privilege for the installing identity.🤖 Generated with Claude Code