Repository navigation
fix: make the security contexts configurable - #112
Conversation
The chart hard-coded the containers' security context, with the seccomp profile RuntimeDefault, which clusters that set their own profile reject (e.g., CSC Rahti). Pubgrade, the updater and MongoDB now take podSecurityContext and securityContext values, rendered with toYaml; the defaults render as before. A seccompProfile set to null, or left empty, is not rendered. Closes #111 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Including the override for clusters that set their own seccomp profile, such as CSC Rahti. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Correct the comments on empty seccomp profiles, check the defaults per workload (none for MongoDB) and the removal for the updater too, and warn against helm upgrade --reuse-values from charts with fixed security contexts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Reviewer's GuideConfigurationDefine configurable pod and container security-context defaults for each workload, preserving the hardened Pubgrade and updater defaults while leaving MongoDB and pod contexts empty.
Render configured pod and container security contexts for MongoDB, Pubgrade, and the updater, omitting empty contexts and empty seccomp profiles.
DocumentationExplain the security-context values and merge behavior, show how to remove seccomp profiles on affected clusters, and advise against unsafe reuse of older Helm values.
TestsCheck default contexts, seccomp-profile removal, custom pod and MongoDB container contexts, and removal of whole contexts across the workloads.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #112 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 1545 1545
=========================================
Hits 1545 1545 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 149a095 #111 fix: make the pod security context configurable · 3 of 3 met
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/chart.sh" line_range="147" />
<code_context>
+ --set mongodb.podSecurityContext.fsGroup=1003 \
+ --set mongodb.securityContext.allowPrivilegeEscalation=false)"
+for id in 1001 1002 1003; do
+ count "${chart}" "fsGroup: ${id}" 1 "pod security context"
+done
+count "${chart}" 'allowPrivilegeEscalation: false' 3 "MongoDB security context"
</code_context>
<issue_to_address>
**Security context checks ignore placement**
When a template renders the requested context in the wrong workload or at the wrong YAML level, a broken template can emit these fields under the wrong workload or at the wrong YAML level; the global `count` assertions still find the expected strings, so the tests pass while the requested security settings are not applied to the intended pod or container.
Assert the contexts within each workload's rendered deployment and at the expected pod or container path.
Also at `tests/chart.sh:149`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and upgrading an existing release with --reuse-values can leave the new security-context values unset, so the app and updater containers may run without their previous restrictions. Reverting the chart restores the hard-coded contexts, but it cannot undo any security exposure that occurred before the rollback.
Blocking findings: tests/chart.sh:147
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Assert the pod and container contexts in each Deployment at their level, as Sourcery suggested. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Other values, such as false, are rendered, so that Kubernetes rejects them instead of the profile being dropped silently, as Sourcery suggested. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary
Since 2026-11-10, CSC Rahti's admission controller rejects pods that set
seccompProfile: type: RuntimeDefault. The chart hard-coded it in the containers' security context. Now:pubgrade,builds.updaterandmongodbeach takepodSecurityContextandsecurityContextvalues (Helm's usual names), rendered withtoYamlthrough one helper; empty contexts render no key.allowPrivilegeEscalation: false,capabilities.drop: [ALL],runAsNonRoot: true,seccompProfile.type: RuntimeDefault; pods and MongoDB have none. The default render is the same YAML as ondev(only the indentation of- ALLdiffers, fromtoYaml).seccompProfile: nullremoves the profile; a profile left empty (seccompProfile.type: null) is left out too. An empty map ({}) can't remove it, as Helm merges it with the default; the docs and values comments say so.docs/deployment.md, "Security contexts"): the values, the exact override for OpenShift/Rahti (--set pubgrade.securityContext.seccompProfile=null), and a warning againsthelm upgrade --reuse-valuesfrom charts up to 0.2.0, whose defaults had no such values.Closes #111
Verification
mise exec [email protected] -- bash tests/chart.sh: new checks failed before the change (7 errors), pass after ("Chart checks passed"). New checks: defaults per workload (--show-only), MongoDB without context,seccompProfile=nullandseccompProfile.type=nullfor Pubgrade and the updater, pod contexts for all three, whole contexts removed.mise exec [email protected] -- helm lint helm --strict: passed.origin/dev: identical apart from the- ALLindentation.mkdocs build --strict(docs group from the lock): passed.Declined review findings
- ALLindentation fromtoYaml): equivalent YAML, no behaviour change.pubgradeandbuilds.updater: kept, as Helm values can't share defaults; the tests check both workloads.--reuse-values): a missing key can't be told apart from one removed withnull, so the docs warn instead.Open questions
None.
🤖 Generated with Claude Code
https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Summary by Sourcery
Make workload security contexts configurable while preserving existing container defaults and supporting clusters that provide their own seccomp profile.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: