address helm chart verification, auth, and TLS options#601
Open
amartin120 wants to merge 3 commits into
Open
Conversation
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
…t in manifest Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
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.
Please check below, if the PR fulfills these requirements:
Types of Changes:
Proposed Changes:
Fixes security finding H1 from the internal security review:
Helm chart --verify, auth, and TLS flags are silently dropped, giving users false confidence that provenance verification or authenticated/TLS chart fetching is in effect when it is not. This is a supply-chain integrity risk — tampered or unauthenticated charts are fetched without complaint.
Root cause:
pkg/content/chart/chart.go's NewChart accepts *action.ChartPathOptions from the caller but only copies Version onto a fresh action.NewInstall(...) client. Every other field (Verify, Username, Password, CertFile, KeyFile, CaFile, InsecureSkipTLSverify, PlainHTTP, Keyring, PassCredentialsAll) was thrown away. CLI flags were correctly bound and passed in — they just never reached Helm.Changes
pkg/content/chart/chart.go— propagate all auth/TLS/verify fields from opts onto client.ChartPathOptions before LocateChart runs. Per-field copy (not blanket *opts assignment) is deliberate so the existing conditional RepoURL handling for OCI / HTTP / bare-name repos stays intact.internal/flags/add.go— add --keyring flag so --verify is fully usable; defaults to Helm's $HOME/.gnupg/pubring.gpg when unset.pkg/apis/hauler.cattle.io/v1/chart.go— extend the Chart manifest type with Verify, Keyring, UsernameEnv, PasswordEnv, PassCredentialsAll, CertFile, KeyFile, CaFile, InsecureSkipTLSverify, PlainHTTP. Credentials are referenced by env-var name — raw username/password values are intentionally not part of the manifest schema.cmd/hauler/cli/store/sync.go— new resolveChartCreds helper resolves UsernameEnv/PasswordEnv to actual values at sync time via os.Getenv. The resolved values are then plumbed into action.ChartPathOptions.Username/Password for that chart entry. Errors loudly if only one of the env-name fields is set, or if both are set but the named env vars are empty/unset — better to fail fast than silently fetch unauthenticated.pkg/content/chart/chart_test.go— regression test TestNewChart_VerifyOnUnsignedChartFails that calls NewChart withVerify: trueagainst the unsigned rancher-cluster-templates-0.5.2.tgz testdata and asserts a provenance-tokened error. Pre-fix this test would fail (nil error returned); post-fix Helm's downloader.VerifyChart runs and errors on the missing .prov.cmd/hauler/cli/store/sync_test.go— five unit tests for resolveChartCreds: empty config, happy path, only-username-env-set, only-password-env-set, both-set-but-env-vars-unset.Manifest example (env-var credentials)
Different charts can reference different env vars — there's no single-credential constraint.
Things we should know...
Verification/Testing of Changes:
Additional Context: