Skip to content

feat: improve Helm chart #12691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from

Conversation

fernandezcuesta
Copy link

@fernandezcuesta fernandezcuesta commented Jun 25, 2025

  • Add extraInitContainers to celery+django deployments.
  • Add extraEnv to all deployments
  • Remove existing volume logic in favor of agnostic extraVolumes and extraVolumeMounts
  • Add the ability to deploy secrets as regular (non-hooked) resources due to issues found with ArgoCD
  • Make some secret references optional (secret might not be created)
  • Fix optional secret mounts + reference
  • Update bitnami chart reference (OCI)
  • Bump up redis chart

Reasoning behind the logic change for volumes, with the existing behaviour we cannot mount projected volumes (e.g. a secret mount where we want the key names being renamed) or per-container volumeMounts (e.g. nginx emptyDir when readOnlyRootFs is enforced).

- Add extraInitContainers to celery+django deployments.
- Add extraEnv to all deployments
- Remove existing volume logic in favor of agnostic extraVolumes and extraVolumeMounts
- Fix optional secret mounts + reference
- Update bitnami chart reference (OCI)
- Bump up redis chart
@github-actions github-actions bot added the helm label Jun 25, 2025
@fernandezcuesta fernandezcuesta changed the title **Summary:** feat: improve Helm chart Jun 25, 2025
Copy link

dryrunsecurity bot commented Jun 25, 2025

DryRun Security

This pull request introduces potential security risks related to optional cryptographic keys, sensitive secret exposure in initializer jobs, and configuration injection vulnerabilities in Helm templates, which could lead to information disclosure, weakened encryption, or potential privilege escalation if not properly managed.

Optional Critical Secrets in helm/defectdojo/templates/tests/unit-tests.yaml
Vulnerability Optional Critical Secrets
Description The patch adds optional: true to DD_SECRET_KEY and DD_CREDENTIAL_AES_256_KEY in unit tests. Making these critical cryptographic keys optional could lead to the application starting without proper encryption, potentially exposing sensitive data or weakening security mechanisms like session management and credential protection.

secretKeyRef:
name: {{ $fullName }}
key: DD_SECRET_KEY
optional: true
- name: DD_CREDENTIAL_AES_256_KEY
valueFrom:
secretKeyRef:
name: {{ $fullName }}
key: DD_CREDENTIAL_AES_256_KEY
optional: true
resources:
{{- toYaml .Values.tests.unitTests.resources | nindent 8 }}
restartPolicy: Never

Sensitive Secret Exposure in helm/defectdojo/templates/initializer-job.yaml
Vulnerability Sensitive Secret Exposure
Description The patch adds a secret reference to {{ $fullName }}-extrasecrets in the initializer job, making environment variables from this secret available to containers. If this secret contains sensitive information like API keys or credentials, its exposure increases the risk of information disclosure, especially if the container or its logs are compromised.

- configMapRef:
name: {{ $fullName }}
- secretRef:
name: {{ $fullName }}-extrasecrets
optional: true
env:
{{- with .Values.initializer.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
resources:

Sensitive Secret Exposure in helm/defectdojo/templates/initializer-job.yaml
Vulnerability Sensitive Secret Exposure
Description The patch adds a secret reference to {{ $fullName }}-extrasecrets in the initializer job, making environment variables from this secret available to containers. If this secret contains sensitive information like API keys or credentials, its exposure increases the risk of information disclosure, especially if the container or its logs are compromised.

- configMapRef:
name: {{ $fullName }}
- secretRef:
name: {{ $fullName }}-extrasecrets
optional: true
env:
- name: DD_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.auth.existingSecret }}
key: {{ .Values.postgresql.auth.secretKeys.userPasswordKey }}
{{- with .Values.initializer.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
resources:

Configuration Injection Risk in helm/defectdojo/values.yaml
Vulnerability Configuration Injection Risk
Description The patch introduces extraEnv, extraInitContainers, extraVolumeMounts, and extraVolumes configuration options. If these values are not properly validated, an attacker could inject malicious environment variables, mount unauthorized volumes, or run malicious init containers, potentially leading to privilege escalation or arbitrary code execution.

# - enabled, enables tracking configuration changes based on SHA256
# trackConfig: disabled
# Avoid using pre-install hooks, which might cause issues with ArgoCD
disableHooks: false
extraLabels: {}
# Add extra labels for k8s
# Enables application network policy


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

@Maffooch Maffooch changed the base branch from master to bugfix June 25, 2025 17:47
Copy link
Contributor

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

@valentijnscholten
Copy link
Member

@fernandezcuesta Thanks for the PR, we'll ask some helm/k8s experienced devs to look at it. In the mean time could you look at the conflicts? Also this seems to be a bigger change, could you look at basing it against the dev branch

@fernandezcuesta fernandezcuesta changed the base branch from bugfix to dev June 26, 2025 06:28
Copy link
Contributor

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

@fernandezcuesta
Copy link
Author

@valentijnscholten done, thanks for having a look at it! I also changed the base to dev branch.

@Maffooch Maffooch requested a review from rossops June 26, 2025 16:07
Copy link
Contributor

@kiblik kiblik left a comment

Choose a reason for hiding this comment

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

I will need more time for the rest (this is not my final review).

repository: https://charts.bitnami.com/bitnami
version: 16.7.0
repository: oci://registry-1.docker.io/bitnamicharts
version: 16.7.13
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH, this is a bit confusing for me. I'm using this chart, and 16.7.13 is automatically selected in the final template even though it is not pinned here. I want to look at this more.

Copy link
Author

Choose a reason for hiding this comment

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

That was autogenerated after a helm dependency update IIRC but can roll it back

@@ -11,9 +11,9 @@ maintainers:
dependencies:
- name: postgresql
version: ~16.7.0
repository: "https://charts.bitnami.com/bitnami"
repository: oci://registry-1.docker.io/bitnamicharts
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice step. I like it.

@valentijnscholten valentijnscholten added this to the 2.49.0 milestone Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants