|
| 1 | +--- |
| 2 | +hip: 9999 |
| 3 | +title: "Default to strict `Chart.yaml` loading" |
| 4 | +authors: [ "George Jenkins <[email protected]>" ] |
| 5 | +created: "2024-11-18" |
| 6 | +type: "feature" |
| 7 | +status: "draft" |
| 8 | +--- |
| 9 | + |
| 10 | +## Abstract |
| 11 | + |
| 12 | +Helm should default to using strict-mode yaml loading for loading charts ie. `yaml.UnmarshalStrict(..)` rather than `yaml.Unmarshal(..)`. |
| 13 | + |
| 14 | + |
| 15 | +## Motivation |
| 16 | + |
| 17 | +Currently Helm loads chart's Chart.yaml in "non-strict" yaml loading mode. |
| 18 | +The main consequence of this behavior is that Helm ignores unknown and duplicate fields in `Chart.yaml`. |
| 19 | +Either unknown to the present version of Helm, or simply typos. |
| 20 | +In that the behavior the user expects from Helm as described by unknown fields is effectively ignored. |
| 21 | +Presenting a confusing experience to the user. |
| 22 | + |
| 23 | + |
| 24 | +## Rationale |
| 25 | + |
| 26 | +Also see: [HIP-9999][hip-9999] ("Forward compatibility: `Chart.yaml` `minimumHelmVersion`"), for a complementary HIP that allows further tightening of Helm's forward compatibility behavior. |
| 27 | + |
| 28 | + |
| 29 | +## Specification |
| 30 | + |
| 31 | +Helm will default to using strict-mode yaml loading for loading charts ie. ie. `yaml.UnmarshalStrict(..)` rather than `yaml.Unmarshal(..)`. |
| 32 | + |
| 33 | +The CLI/SDK will contain an option to allow non-strict loading. |
| 34 | +This is to allow users to continue to utilize charts that are malformed. |
| 35 | + |
| 36 | + |
| 37 | +## Backwards compatibility |
| 38 | + |
| 39 | +Helm 4 allows breaking behavioral changes. |
| 40 | +However it is a core premise that Helm 4 will remain compatibility with existing chart. |
| 41 | +Moving to strict mode for loading yaml will prevent charts from being loaded that contain unknown/invalid fields. |
| 42 | +Requiring a command line flag / SDK option allows fallback compatibility if required. |
| 43 | + |
| 44 | +## Security implications |
| 45 | + |
| 46 | +N/A |
| 47 | + |
| 48 | + |
| 49 | +## How to teach this |
| 50 | + |
| 51 | +Update `Chart.yaml` docs |
| 52 | + |
| 53 | + |
| 54 | +## Reference implementation |
| 55 | + |
| 56 | +See PR links in [References] |
| 57 | + |
| 58 | + |
| 59 | +## References |
| 60 | + |
| 61 | +- \[chart/loader\] use strict yaml unmarshaling for chart files <https://github.com/helm/helm/pull/11818> |
| 62 | +- fix(pkg/lint): unmarshals Chart.yaml strictly <https://github.com/helm/helm/pull/12382> |
| 63 | + |
| 64 | +[hip-9999]: ./hip-9999.md |
0 commit comments