fix: reject non-semver versions for OCI charts#7900
Conversation
Signed-off-by: immanuwell <pchpr.00@list.ru>
|
In what state would the I'm also wondering if we'd be able to validate that on the API level via CEL or something? With webhook validation for sure, but that's a bit bigger effort to make happen. Not saying it might be worth it but CEL can do pretty powerful things too |
Would probably be good if we could cover this in the Helm integration test.
We don't need CEL or a webhook for this, I'd say. As long as the error reporting on the Chart resource is understandable, I'd keep it simple. Especially for CEL, we'd need to re-implement a Go library function (if that's even possible) and keep the CEL in sync with upstream changes. Moreover, the CEL is part of the CRDs, so changing this in patch releases needs special care. A webhook could of course just call the Go function, but we'd need to setup a validating webhook from scratch, just for this. Feels like overkill. If the webhook would already be in place, then things would be different, of course. Maybe some day... |
Why? Isn't the API-server validating things with CEL?
Sure. I just think if we can use CEL to validate this properly, we should. In a minor release maybe... |
Description
Fixes #5156
OCI charts with an empty or non semver
versioncould panic in Helm download code. This patch bails out early and returns a clean error instead. Small fix, but it kills a nasty footgun.Type of change
How Has This Been Tested?
Repro:
spec.versionempty, or set it tolatestOCI charts require a fixed SemVer versionChecks I ran:
go test ./pkg/helm -run TestCommands_locateChart_OCIRequiresFixedVersion -count=1go test ./pkg/helm/...Checklist