You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This intends to fix a potential security issue introduced via #458 before
cutting the next helm-diff release.
Since #458 (unreleased), we had forced helm-diff to use `helm template --dry-run=server` for Helm 3.13 or greater.
I think this can create an unintended security hole, where any users, who can run
helm-diff via CI or any automation with an arbitrary chart and values, is able
to view cluster resources via helm template's `lookup` functions.
Previously this was impossible because `helm template` run by `helm diff` had
no access to the `lookup` function. To fix this, we need to make `--dry-run=server`
optional. And we do so by introducing a new flag `--dry-run=[|client|server]` to helm-diff.
See the updated README and the updated helm-diff help message for more details.
returnnil, fmt.Errorf("`diff upgrade --dry-run` conflicts with HELM_DIFF_USE_UPGRADE_DRY_RUN_AS_TEMPLATE. Either remove --dry-run to enable cluster access, or unset HELM_DIFF_USE_UPGRADE_DRY_RUN_AS_TEMPLATE to make cluster access unnecessary")
198
-
}
196
+
//
197
+
// # `--dry-run=client` or `--dry-run=server`?
198
+
//
199
+
// Or what's the relationoship between helm-diff's --dry-run flag,
200
+
// HELM_DIFF_UPGRADE_DRY_RUN env var and the helm upgrade --dry-run flag?
201
+
//
202
+
// If the program reaches here,
203
+
// we are sure that the user wants to user the `helm upgrade --dry-run` command
204
+
// for generating the manifests to be diffed.
205
+
//
206
+
// However, which dry-run mode to use is still not clear.
207
+
//
208
+
// For compatibility with the old and new helm-diff options,
209
+
// old and new helm, we assume that the user wants to use the `--dry-run=client` mode
210
+
// if helm-diff has been invoked with any of the following flags:
211
+
//
212
+
// * --dry-run
213
+
// * --dry-run=""
214
+
// * --dry-run=client
215
+
//
216
+
// Otherwise, we assume that the user wants to use the `--dry-run=server` mode.
217
+
//
199
218
200
219
ifd.isAllowUnreleased() {
201
220
// Otherwise you get the following error when this is a diff for a new install
dryRunUsage="--dry-run, --dry-run=client, or --dry-run=true disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation."+
101
+
" --dry-run=server enables the cluster access with helm-get and the lookup template function."
f.BoolVar(&diff.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.")
194
261
f.BoolVar(&diff.disableValidation, "disable-validation", false, "disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install")
195
262
f.BoolVar(&diff.disableOpenAPIValidation, "disable-openapi-validation", false, "disables rendered templates validation against the Kubernetes OpenAPI Schema")
196
-
f.BoolVar(&diff.dryRun, "dry-run", false, "disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation")
197
263
f.StringVar(&diff.postRenderer, "post-renderer", "", "the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path")
198
264
f.StringArrayVar(&diff.postRendererArgs, "post-renderer-args", []string{}, "an argument to the post-renderer (can specify multiple)")
199
265
f.BoolVar(&diff.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the chart download")
0 commit comments