Skip to content

feat!(security): addition of security context to allow CIS compliance #3

Open
ferdiekrammer wants to merge 1 commit into
technicaldomain:mainfrom
ferdiekrammer:CIS-Profile-dev
Open

feat!(security): addition of security context to allow CIS compliance #3
ferdiekrammer wants to merge 1 commit into
technicaldomain:mainfrom
ferdiekrammer:CIS-Profile-dev

Conversation

@ferdiekrammer

Copy link
Copy Markdown

addition to security contexts to make the helm chart CIS compliant

issues

mlflow-oidc/helm#11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds pod and container security-context helpers to the common Helm chart to support CIS-oriented hardening defaults.

Changes:

  • Splits pod security context into common.security.podContext while preserving common.security.context.
  • Adds common.security.containerContext and includes it in the common container template.
  • Adds temp.yaml to the common chart .helmignore.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
charts/common/templates/_security_context.yaml Adds pod/container security context templating and defaults.
charts/common/templates/_container.yaml Includes the new container security context in rendered containers.
charts/common/.helmignore Ignores temp.yaml.
Comments suppressed due to low confidence (1)

charts/common/templates/_security_context.yaml:53

  • The container seccomp rendering has the same loss of localhostProfile: containerSecurityContext.seccompProfile.type: Localhost with a configured profile path renders only the type, so Kubernetes cannot apply the intended Localhost profile.
  {{- if $seccomp }}
  seccompProfile:
    type: {{ $seccomp.type }}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +16 to +18
{{- if hasKey $context "seccompProfile" }}
seccompProfile:
type: {{ $context.seccompProfile.type }}
Comment on lines +41 to +50

securityContext:
runAsNonRoot: {{ $runAsNonRoot }}
runAsUser: {{ $runAsUser }}
allowPrivilegeEscalation: {{ $allowPrivEsc }}
readOnlyRootFilesystem: {{ $readOnlyRoot }}
{{- if and .Values.containerSecurityContext (hasKey $ctr "capabilities") }}
capabilities:
{{- toYaml $ctr.capabilities | nindent 4 }}
{{- end }}
*/}}
{{- $runAsNonRoot := ternary $ctr.runAsNonRoot (ternary $pod.runAsNonRoot true (hasKey $pod "runAsNonRoot")) (hasKey $ctr "runAsNonRoot") -}}
{{- $runAsUser := ternary $ctr.runAsUser (ternary $pod.runAsUser 1001 (hasKey $pod "runAsUser")) (hasKey $ctr "runAsUser") -}}
{{- $seccomp := ternary $ctr.seccompProfile (ternary $pod.seccompProfile nil (hasKey $pod "seccompProfile")) (hasKey $ctr "seccompProfile") -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants