activepieces icon indicating copy to clipboard operation
activepieces copied to clipboard

[BUG] Helm chart and image not compatible with OpenShift restricted SCC (non-root UID, no capabilities, port above 1024)

Open majewskibartosz opened this issue 2 months ago • 5 comments

Problem

Helm install on OpenShift 4.22 under the default restricted-v2 SCC: pod runs as an arbitrary non-root UID with GID 0, all capabilities dropped, no privilege escalation, ports below 1024 blocked. Chart default container.port: 80 + AP_PORT=80 fails: listen EACCES: permission denied :::80. Follow-up to activepieces/activepieces#15739 / PR 15774, which was tested on kind only. OpenShift never tested on our side. No OpenShift or non-root guidance in docs/install/options/helm.mdx or deploy/activepieces-helm.

Ref: Pylon 6080

Root cause

  • Dockerfile has no USER; image assumes root. values.yaml container.port: 80; docker-entrypoint.sh defaults AP_PORT to 80. Privileged port under a non-root UID with no NET_BIND_SERVICE.
  • securityContext / podSecurityContext in values.yaml are empty passthroughs; nothing sets a non-root-safe default.
  • StatefulSet path hardcodes storageClassName: local-path (deployment.yaml).
  • Bundled subcharts (postgresql.enabled / redis.enabled): pinned postgresql 11.7.2 and redis 17.4.2 (both late 2022) hardcode runAsUser: 1001 / fsGroup: 1001 in primary, readReplicas, master, replica pod and container securityContexts, which restricted-v2 rejects. Neither version has global.compatibility.openshift.adaptSecurityContext. Confirmed on a real OpenShift 4.22 cluster by the reporter; workaround was <component>.podSecurityContext.enabled=false + <component>.containerSecurityContext.enabled=false on every component. Last chart versions before the Bitnami image freeze (2025-08-28) that carry the switch (auto by default) and whose images still exist under bitnamilegacy/*: postgresql 16.7.27 (image 17.6.0-debian-12-r4) and redis 22.0.7 (image 8.2.1-debian-12-r0). Newer charts pin tag: latest only. See activepieces/activepieces#10795.

Docker emulation of the SCC on image 0.91.1 (--user 1000680000:0 --cap-drop ALL --security-opt no-new-privileges, cache volume group-0 writable, AP_EDITION=ee, AP_EXECUTION_MODE=SANDBOX_CODE_ONLY):

  • AP_PORT=80: exit 1, listen EACCES.
  • AP_PORT=8080: boots, sign-up, worker connects. Plain code step and text-helper piece step (bundle download + bun install) SUCCEEDED. No EACCES / EPERM.
  • Code step with an npm dependency fails identically as root (SANDBOX_CODE_ONLY has no npm). Not a UID issue.
  • mittwald secret-generator image runs as UID 65532.

Not verified: real OpenShift cluster, Route vs Ingress, readOnlyRootFilesystem, Helm lookup under OpenShift RBAC.

Fix

  1. Verify on a real OpenShift cluster (OpenShift Local / CRC) under restricted-v2; record every rejection.
  2. Chart: container.port / AP_PORT above 1024 working out of the box (new default, or a documented override if changing the default is breaking).
  3. Docs: OpenShift / non-root section: port override, persistence.storageClassName, SANDBOX_CODE_ONLY as the no-capabilities mode, npm-in-code-steps limit.
  4. Optional: USER in the Dockerfile with group-0-writable app dirs, so non-root needs no SCC exception anywhere.
  5. Bump the Bitnami subcharts to postgresql 16.7.27 and redis 22.0.7 (last pre-freeze versions with adaptSecurityContext: auto), keep image.repository: bitnamilegacy/*, re-run helm dependency build. Existing installs: PostgreSQL 14 -> 17 is a major upgrade of the bundled DB, needs a migration note.

Out of scope: SANDBOX_PROCESS / SANDBOX_CODE_AND_PROCESS, need CAP_SYS_ADMIN, cannot run under a restricted SCC.

majewskibartosz avatar Sep 24 '26 14:09 majewskibartosz

GIT-1929

linear-code[bot] avatar Sep 24 '26 14:09 linear-code[bot]

Hi @majewskibartosz, thanks for the detailed repro. There's one more piece: the chart never passes container.port to the app. AP_PORT stays at 80, so changing container.port alone moves the probes to a port nothing listens on.

I have a chart-only fix ready:

container.port defaults to 8080 and is wired to AP_PORT. The Service stays on 80. securityContext stays empty by default, so SANDBOX_PROCESS users don't break. The values file and a new docs section give the restricted/OpenShift recipe instead. CI checks for the port wiring.

I'll open the PR shortly. The Dockerfile USER change can be a follow-up.

gypsy5oul avatar Sep 25 '26 11:09 gypsy5oul

I opened #15802 for this, but it was auto-closed by the pause on external PRs, so I'm leaving the fix here for whoever picks this up. The branch is https://github.com/gypsy5oul/activepieces/tree/fix/helm-nonroot-port-15780 (6 files, CLA signed, merges cleanly into main).

What it does:

container.port defaults to 8080 and is passed to the app as AP_PORT. The Service stays on port 80. The test pod gets a restricted securityContext. Adds docs for OpenShift and the restricted Pod Security Standard, plus CI assertions.

Tested on RKE2 in a namespace enforcing restricted, as UID 1000680000 with GID 0 and no capabilities, with ip_unprivileged_port_start=1024 to match CRI-O/OpenShift:

Port 8080 runs and helm test passes. Port 80 fails with listen EACCES :::80.

One detail: containerd 2.x and Docker set that sysctl to 0, so this only shows up on CRI-O clusters like OpenShift.

@majewskibartosz, if you want to try it on your cluster before a fix lands: helm install ... -f from that branch, or just set container.port: 8080 and activepiecesConfig.AP_PORT: "8080" on the current chart.

gypsy5oul avatar Sep 25 '26 12:09 gypsy5oul

Small update to the branch since my last comment (31578805a3). #15802 is closed, so it doesn't show this commit.

  • The test pod now uses the chart's own securityContext and podSecurityContext instead of a fixed runAsUser: 65534. It's admitted wherever the app pod is, including under an OpenShift SCC that assigns the UID itself.
  • CI now also checks that AP_PORT set through an activepiecesEnvVariables secret list renders once, so the chart doesn't add a duplicate entry.

I re-tested on the same RKE2 setup (restricted PSA, UID 1000680000, GID 0, all capabilities dropped, ip_unprivileged_port_start=1024). The app listens on 8080, and helm test passes with the test pod running as the same UID as the app.

The branch still merges cleanly into main.

gypsy5oul avatar Sep 25 '26 12:09 gypsy5oul

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If this issue is continuing with the latest stable version of Activepieces, please open a new issue that references this one.

github-actions[bot] avatar Oct 04 '26 21:10 github-actions[bot]