Skip to content

Conversation

@kiblik
Copy link
Contributor

@kiblik kiblik commented Oct 13, 2025

Fix #13323

#13331 was replaced only in docker-compose. This PR replaces it in the HELM chart as well.
Official Valkey HELM charts would require too many customisations; we needed something more developed. https://artifacthub.io/packages/helm/cloudpirates-valkey/valkey supported many fields that are compatible with the previous Bitnami stack.

There are multiple places that are mentioned in release notes.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@Maffooch
Copy link
Contributor

Hi @kiblik the valkey migration is slated for release in the upcoming minor release on November 3rd. The docker compose PR looks ready to roll after your feedback was incorporated. Is there anything left to be implemented in this PR for the helm chart?

@kiblik
Copy link
Contributor Author

kiblik commented Nov 3, 2025

So, my original idea was to replace Bitnami Redis with the official Valkey Helm chart. Unfortunately, this is not fully possible because authN issue.
The official Valkey Helm chart does not support the approach: "This is a password which I generated/prepared for you. Use it". Valkey needs the users.acl file with the full definition of users.
This issue is partially solved in the open PR, but still not fully support "This is a prepared password. Use it."
So we might

  • use Valkey chart from Bitnami. But charts and/or Docker images would have to be mirrored (not a good and maintainable solution)
  • use CloudPirates chart (comes from the original Bitnami definition, but they keep it nicely maintained)
  • use deployment without authN (we might depend on network isolation using NetworkPolicy)
  • ???

@kiblik
Copy link
Contributor Author

kiblik commented Nov 3, 2025

I hope migration will be easier, and I did not have enough time to come back to it until now.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@kiblik kiblik force-pushed the helm_valkey branch 5 times, most recently from 5bf0d34 to 854c188 Compare November 4, 2025 18:13
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Conflicts have been resolved. A maintainer will review the pull request shortly.

@kiblik kiblik force-pushed the helm_valkey branch 12 times, most recently from bf3a0d5 to 196988a Compare November 5, 2025 10:27
@kiblik kiblik force-pushed the helm_valkey branch 2 times, most recently from eb207b8 to 52ea586 Compare November 13, 2025 13:59
@github-actions github-actions bot added the docs label Nov 13, 2025
@kiblik kiblik force-pushed the helm_valkey branch 5 times, most recently from 3ecc8f5 to 639528c Compare November 13, 2025 16:18
@kiblik
Copy link
Contributor Author

kiblik commented Nov 13, 2025

This PR is fully ready for review.

Copy link
Contributor

@fernandezcuesta fernandezcuesta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kiblik added some logic and yet another parameter to better isolate the 2 options (external Redis vs Valkey). Rather than that LGTM

Comment on lines 68 to 79
{{- /*
Determine the protocol to use for Redis.
*/}}
{{- define "redis.scheme" -}}
{{- if eq .Values.celery.broker "redis" -}}
{{- if .Values.redis.tls.enabled -}}
{{- if .Values.valkey.tls.enabled -}}
{{- printf "rediss" -}}
{{- else if .Values.redis.sentinel.enabled -}}
{{- else if .Values.valkey.sentinel.enabled -}}
{{- printf "sentinel" -}}
{{- else -}}
{{- printf "redis" -}}
{{- end -}}
{{- end -}}
Copy link
Contributor

@fernandezcuesta fernandezcuesta Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{- /*
Determine the protocol to use for Redis.
*/}}
{{- define "redis.scheme" -}}
{{- if eq .Values.celery.broker "redis" -}}
{{- if .Values.redis.tls.enabled -}}
{{- if .Values.valkey.tls.enabled -}}
{{- printf "rediss" -}}
{{- else if .Values.redis.sentinel.enabled -}}
{{- else if .Values.valkey.sentinel.enabled -}}
{{- printf "sentinel" -}}
{{- else -}}
{{- printf "redis" -}}
{{- end -}}
{{- end -}}
{{- /*
Determine the default params to use for Redis.
*/}}
{{- define "redis.params" -}}
{{- $redisScheme := template "redis.scheme" . -}}
{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" (eq "rediss" $redisScheme -}}
{{- if .Values.valkey.enabled -}}
{{- default $defaultBrokerParams .Values.valkeyParams -}}
{{- else -}}
{{- default $defaultBrokerParams .Values.redisParams -}}
{{- end -}}
{{- /*
Determine the protocol to use for Redis.
*/}}
{{- define "redis.scheme" -}}
{{- if .Values.valkey.enabled -}}
{{- if .Values.valkey.tls.enabled -}}
rediss
{{- else if .Values.valkey.sentinel.enabled -}}
sentinel
{{- else -}}
redis
{{- end -}}
{{- else -}}
{{- .Values.redisScheme -}}
{{- end -}}
{{- end -}}

@@ -1,5 +1,5 @@
{{- $fullName := include "defectdojo.fullname" . -}}
{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" .Values.redis.tls.enabled -}}
{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" .Values.valkey.tls.enabled -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" .Values.valkey.tls.enabled -}}
{{- $redisScheme := template "redis.scheme" . -}}
{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" (eq "rediss" $redisScheme -}}

Comment on lines 670 to 706

#
# External database support.
#
# @schema type:[string, null]
# -- To use an external Redis instance, set `redis.enabled` to false and set the address here:
redisServer: ~
# -- Parameters attached to the redis connection string, defaults to "ssl_cert_reqs=optional" if `redis.tls.enabled`
# -- Parameters attached to the redis connection string, defaults to "ssl_cert_reqs=optional" if `valkey.tls.enabled`
redisParams: ""
Copy link
Contributor

@fernandezcuesta fernandezcuesta Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
redisParams: ""
# -- Parameters attached to the valkey connection string, defaults to "ssl_cert_reqs=optional" if `valkey.tls.enabled`
valkeyParams: ""
#
# External database support.
#
# @schema type:[string, null]
# -- To use an external Redis instance, set `redis.enabled` to false and set the address here:
redisServer: ~
# -- Parameters attached to the redis connection string, defaults to "ssl_cert_reqs=optional" if `redisScheme` is `rediss`
redisParams: ""
# -- Define the protocol to use with the external Redis instance
redisScheme: redis

Copy link
Contributor

@fernandezcuesta fernandezcuesta Nov 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the scheme and params should be isolated when using an external redis or when opting in for Valkey.

⚠️ didn't tested myself though, but hope the logic is clear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach. As it hasn't been tested, I will need more time to do that. I will check it next week.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@sgissi
Copy link

sgissi commented Nov 20, 2025

So, my original idea was to replace Bitnami Redis with the official Valkey Helm chart. Unfortunately, this is not fully possible because authN issue. The official Valkey Helm chart does not support the approach: "This is a password which I generated/prepared for you. Use it". Valkey needs the users.acl file with the full definition of users. This issue is partially solved in the open PR, but still not fully support "This is a prepared password. Use it." So we might

Hi, I'm one of the Valkey Helm chart maintainers. We have implemented both inline and secret-based passwords in the chart. Note that it currently only supports standalone deployments with replicas coming soon.

@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@dryrunsecurity
Copy link

dryrunsecurity bot commented Nov 20, 2025

DryRun Security

This pull request introduces several security concerns: documentation encourages Helm-generated Valkey secrets without warning, the Valkey Helm chart is sourced from an unverified OCI repo (supply-chain risk), TLS defaults disable proper certificate validation for Celery (ssl_cert_reqs=optional), and the chart generates a relatively weak 10-character alphanumeric Valkey password (~59.5 bits entropy).

Insecure Documentation Examples in helm/defectdojo/README.md.gotmpl
Vulnerability Insecure Documentation Examples
Description The documentation examples in README.md.gotmpl consistently use --set createValkeySecret=true in helm install commands. This flag instructs Helm to generate and manage the Valkey secret, which can be less secure for production environments compared to using external secret managers or pre-existing, securely provisioned secrets. The documentation does not provide warnings about the implications of using Helm-generated secrets in production, nor does it guide users towards more secure alternatives that the chart itself supports (e.g., valkey.auth.existingSecret).

--set django.ingress.enabled=${DJANGO_INGRESS_ENABLED} \
--set django.ingress.activateTLS=${DJANGO_INGRESS_ACTIVATE_TLS} \
--set createSecret=true \
--set createValkeySecret=true \
--set createPostgresqlSecret=true
```

Supply Chain Risk from Unverified Helm Chart in helm/defectdojo/Chart.yaml
Vulnerability Supply Chain Risk from Unverified Helm Chart
Description The Helm chart for 'valkey' is sourced from an unverified repository ('oci://registry-1.docker.io/cloudpirates'). There is no evidence to suggest that 'cloudpirates' is a reputable or official publisher for Valkey Helm charts, nor is it associated with the official Valkey project or trusted vendors like Bitnami. This introduces a significant supply chain risk, as the integrity and security of the deployed chart cannot be assured.

repository: "oci://registry-1.docker.io/cloudpirates"
condition: valkey.enabled
# For correct syntax, check https://artifacthub.io/docs/topics/annotations/helm/
# This is example for "artifacthub.io/changes"

Insecure Default TLS Configuration in helm/defectdojo/templates/configmap.yaml
Vulnerability Insecure Default TLS Configuration
Description The Helm chart's default configuration for the Celery broker connection to Valkey sets ssl_cert_reqs=optional when TLS is enabled (rediss scheme). This setting disables proper server certificate validation, allowing Man-in-the-Middle (MitM) attacks where an attacker can intercept and potentially tamper with communications without detection. While the chart provides valkeyParams to override this, the default is insecure.

{{- $defaultBrokerParams := ternary "ssl_cert_reqs=optional" "" (eq "rediss" $redisScheme) -}}
apiVersion: v1
kind: ConfigMap
metadata:

Weak Password Generation in helm/defectdojo/templates/secret-valkey.yaml
Vulnerability Weak Password Generation
Description The Helm chart generates a 10-character alphanumeric password for Valkey using randAlphaNum 10. This results in approximately 59.54 bits of entropy. While there isn't a single universally agreed-upon minimum entropy for all machine-generated secrets, security best practices often recommend higher entropy for long-lived secrets. For instance, OWASP suggests 64 bits of entropy for session IDs, and cryptographic key recommendations can go as high as 112 bits for long-term security. A password with ~59.54 bits of entropy is below these common recommendations, making it potentially vulnerable to offline brute-force attacks if the secret hash is compromised, especially in high-security environments.

{{ .Values.valkey.auth.existingSecretPasswordKey }}: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end }}


All finding details can be found in the DryRun Security Dashboard.

@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

1 similar comment
@github-actions
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Signed-off-by: kiblik <5609770+kiblik@users.noreply.github.com>
@github-actions
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@kiblik kiblik force-pushed the helm_valkey branch 2 times, most recently from d65f11d to eaee0fe Compare November 24, 2025 21:16
Signed-off-by: kiblik <5609770+kiblik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants