Skip to content

feat: allow setting container and job security contexts - #131

Open
agmlena wants to merge 1 commit into
passbolt:mainfrom
agmlena:feat/container-security-context
Open

agmlena wants to merge 1 commit into
passbolt:mainfrom
agmlena:feat/container-security-context

Conversation

@agmlena

@agmlena agmlena commented Oct 21, 2026

Copy link
Copy Markdown

What

Adds values to set security contexts on every workload the chart renders. Only the server pod had one (podSecurityContext); the containers, the email cron job and the GPG/JWT key jobs had none, and the cron job hardcoded runAsUser: 33 / fsGroup: 33. A namespace enforcing the Pod Security Admission restricted profile therefore cannot run the chart without patching the rendered manifests (the approach described in #129).

New values, all empty by default:

Value Applies to
containerSecurityContext containers running the passbolt image: server, proc-email cron job, GPG and JWT key jobs
app.cache.redis.sentinelProxy.securityContext redisproxy sidecar (server and cron job pods)
app.databaseInitContainer.securityContext database init container
cronJobEmail.podSecurityContext email cron job pod
jobCreateGpgKeys.podSecurityContext, jobCreateJwtKeys.podSecurityContext key job pods

When cronJobEmail.podSecurityContext is empty the cron job still gets runAsUser: 33 and fsGroup: 33 (the default lives in the template, not in values.yaml, because Helm would otherwise merge a user value into it and fsGroup could not be removed). A value set there replaces the default.

Refs #129. That issue also asks for defaults; this PR keeps every default empty so existing installs render the same, and leaves choosing defaults to the maintainers.

Compatibility

No behaviour change with default values. Rendering with tests/values-test.yaml before and after differs in the cron job only by key order inside its securityContext (fsGroup now precedes runAsUser, because toYaml sorts keys). With Openshift: true the render is identical.

Tests

  • tests/security_context_test.yaml: 10 cases covering the defaults (no container context, cron job keeps 33/33), each new value on each workload, the cron job override replacing the default, and the OpenShift case.
  • helm unittest .: 31 suites, 106 tests pass. helm lint . passes.
  • README parameter table and CHANGELOG updated.

I have not run the changed chart on a cluster with these values applied. For reference, the 5.16.0-1-ce-non-root image runs supervisord as uid 33 with no effective capabilities, so allowPrivilegeEscalation: false, capabilities.drop: [ALL] and seccompProfile: RuntimeDefault are what I would expect to work; I would treat that as unconfirmed until someone runs it.

Only the server pod had a configurable security context
(podSecurityContext). The containers, the email cron job and the GPG and JWT
key jobs had none, and the cron job hardcoded runAsUser and fsGroup, so a
namespace could not satisfy the Pod Security Admission "restricted" profile
without patching the rendered manifests.

Add, all empty by default:

- containerSecurityContext: containers running the passbolt image (server,
  email cron job, GPG and JWT key jobs)
- app.cache.redis.sentinelProxy.securityContext: redisproxy sidecar in the
  server and email cron job pods
- app.databaseInitContainer.securityContext: database init container
- cronJobEmail.podSecurityContext, jobCreateGpgKeys.podSecurityContext,
  jobCreateJwtKeys.podSecurityContext: pod-level contexts of the jobs

When cronJobEmail.podSecurityContext is empty the cron job keeps
runAsUser: 33 and fsGroup: 33, so the rendered output is unchanged for
existing installs apart from the key order of that block.

Refs passbolt#129
@CLAassistant

CLAassistant commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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