Repository navigation
feat!(security): addition of security context to allow CIS compliance - #3
ferdiekrammer wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.podContextwhile preservingcommon.security.context. - Adds
common.security.containerContextand includes it in the common container template. - Adds
temp.yamlto 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: Localhostwith 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.
| {{- if hasKey $context "seccompProfile" }} | ||
| seccompProfile: | ||
| type: {{ $context.seccompProfile.type }} |
|
|
||
| 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") -}} |
|
Thank you @ferdiekrammer for starting this. #5 built on the same idea and has been merged instead (released as |
addition to security contexts to make the helm chart CIS compliant
issues
mlflow-oidc/helm#11