Skip to content

Commit d5dbefe

Browse files
authored
fix: firstuser defaults should not fire constraint (#4227)
1 parent 8d0993b commit d5dbefe

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

charts/camunda-platform-8.8/templates/common/constraints.tpl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@ Usage: {{ include "camundaPlatform.secretConfigurationWarnings" . }}
303303
(and (hasKey $config $plaintextKey) (ne (get $config $plaintextKey | default "" | toString) "") (ne (get $config $plaintextKey | toString) "")) -}}
304304
{{- $hasLegacyConfig = true -}}
305305
{{- end -}}
306+
307+
{{/* Unset legacy flag for identity.firstUser when using chart defaults */}}
308+
{{- if and (eq $path "identity.firstUser") $hasLegacyConfig -}}
309+
{{- if and (eq (get $config $legacySecretKey | toString) "camunda-credentials") (eq (get $config $plaintextKey | toString) "demo") -}}
310+
{{- $hasLegacyConfig = false -}}
311+
{{- end -}}
312+
{{- end -}}
306313
{{- end -}}
307314

308315
{{/* Check if new configuration is used */}}
@@ -350,14 +357,17 @@ Usage: {{ include "camundaPlatform.secretConfigurationWarnings" . }}
350357

351358
{{/* Warn about insecure legacy plaintext usage */}}
352359
{{- if and $config (kindOf $config | eq "map") (hasKey $config $plaintextKey) (ne (get $config $plaintextKey | default "" | toString) "") (ne (get $config $plaintextKey | toString) "") -}}
353-
{{- $warningMessage := printf "%s %s %s %s %s"
354-
"[camunda][warning]"
355-
(printf "SECURITY: %s is using legacy plaintext field '%s' at '%s.%s'." $component $plaintextKey $path $plaintextKey)
356-
"This stores secrets as plain-text in the Helm values and is NOT suitable for production use."
357-
"For production environments, please use Kubernetes Secrets"
358-
(printf "with '%s.secret.existingSecret' and '%s.secret.existingSecretKey'." $path $path)
359-
-}}
360-
{{ printf "\n%s" $warningMessage | trimSuffix "\n" }}
360+
{{/* Skip warning for identity.firstUser when using chart default password */}}
361+
{{- if not (and (eq $path "identity.firstUser") (eq (get $config $plaintextKey | toString) "demo")) -}}
362+
{{- $warningMessage := printf "%s %s %s %s %s"
363+
"[camunda][warning]"
364+
(printf "SECURITY: %s is using legacy plaintext field '%s' at '%s.%s'." $component $plaintextKey $path $plaintextKey)
365+
"This stores secrets as plain-text in the Helm values and is NOT suitable for production use."
366+
"For production environments, please use Kubernetes Secrets"
367+
(printf "with '%s.secret.existingSecret' and '%s.secret.existingSecretKey'." $path $path)
368+
-}}
369+
{{ printf "\n%s" $warningMessage | trimSuffix "\n" }}
370+
{{- end -}}
361371
{{- end -}}
362372

363373
{{- end -}}

0 commit comments

Comments
 (0)