feat(helmchart): add minAge field to delay artifact promotion#2060
feat(helmchart): add minAge field to delay artifact promotion#2060Solvik wants to merge 1 commit into
Conversation
Add spec.minAge on HelmChart to require a chart version to have been published for a minimum duration before it is promoted as an artifact. When the requirement is not met, the controller sets ArtifactInStorage=False with reason ChartVersionTooNew and requeues for exactly the remaining duration. Only applies to HelmRepository sources where the publish timestamp is available from the repo index.
|
Flux users should move away from HTTP/S repos and switch to The minAge feature could be added to flux-mirror which syncs Helm charts from HTTP/S repos to container registries. I suggest creating an issue for this feature in the flux-mirror repository. |
|
Thanks for the context, I wasn't aware HelmRepository |
Impossible, the OCI spec does not return timestamps when listing tags, like supported by the Helm index. The solution for this problem is controlling the sync period yourself by running the Please open an issue for |
|
Note: |
|
This minAge feature could trick users into thinking it's a security feature while it's not. If an attacker gains access to GitHub, it can modify the Helm index Why minAge works for npm, is due to the fact that npm is a SaaS that doesn't allow the publisher to manipulate the timestamps. Given this, I don't think we should add this feature in Flux at all, it will trick users to upgrade while the charts/images timestamps are manipulated. |
|
We may have a chance to implement this in flux-mirror for signed OCI artifacts by looking at the signature timestamp in the public Rekor instance, since that timestamp can not be manipulated. This of course will not wok for Helm HTTP/S repos, it could only work for Helm OCI charts, Flux OCI artifacts, and container images signed with cosign keyless. |
|
Is there a limitation when configuring a private Rekor? Defining which Rekor the CLI should trust could be useful |
|
Thanks for taking the time to explain this during your week-end guys :) |
Hello,
I've been thinking about this with the recent supply chain attacks and thought it would be an interesting feature to provide so we can add a layer of mitigation for flux users.
The idea is simple: add a
spec.minAgefield onHelmChartthat requires a chart version to have been published for a minimum duration before it gets promoted as an artifact.This way, if a malicious versionis pushed to a Helm repository, semver ranges won't immediately pick it up, giving time to detect and react before it hits any cluster.
Example
Implementation
reconcileMinAgebetweenreconcileSourceandreconcileArtifactChartVersion.Createdin the repo index, carried via a newCreatedAtfield onchart.BuildArtifactInStorage=False/ChartVersionTooNew, requeues for the exact remaining durationGitRepositoryandBucketsources (no timestamp available)Of course, I'm happy to get feedback on the approach and open to any guidance on what would make this acceptable for the project