Fixes #420: Harden Helm chart security defaults - #434
Conversation
|
There was a problem hiding this comment.
Removed the custom chart security-context test and wiring.
| {{- with .Values.extraVolumes }} | ||
| volumes: | ||
| - name: tmp | ||
| emptyDir: {} |
There was a problem hiding this comment.
- let's have default values for in
resourcesin values.yaml
resources:
requests:
cpu: 100m
memory: 256Mi
ephemeral-storage: 256Mi
limits:
cpu: 200m
memory: 512Mi
ephemeral-storage: 512Mi
and let's make this empty dir size equal to resources.limits.ephemeral-storage if it is not undefined
| STANDALONE=false \ | ||
| HOST=0.0.0.0 | ||
| HOST=0.0.0.0 \ | ||
| HOME=/tmp |
There was a problem hiding this comment.
ideally I don't want to change HOME,
rather the code should take care to always use platform specific tmp dir to write to
Let's look at all code and see if something is writing outside of /tmp
| && npm cache clean --force | ||
|
|
||
| RUN groupadd --gid 10001 trueforge \ | ||
| && useradd --uid 10001 --gid trueforge --home-dir /tmp --no-create-home --shell /usr/sbin/nologin trueforge |
There was a problem hiding this comment.
related to above comment
| && useradd --uid 10001 --gid trueforge --home-dir /tmp --no-create-home --shell /usr/sbin/nologin trueforge | |
| && useradd --uid 10001 --gid trueforge |
Summary
Hardens the TrueForge Helm deployment so the server container no longer runs as root by default. The chart now renders restricted pod/container security contexts and mounts
/tmpas writable storage soreadOnlyRootFilesystem: trueworks.Closes #420
Changes
10001:10001inDockerfileandDockerfile.devpodSecurityContextand containersecurityContext/tmpemptyDirvolume mount for writable temp storageHow was this tested?
pnpm buildpnpm testpnpm typecheckpnpm lint:cipnpm chart:depspnpm chart:lintpnpm chart:templatepnpm test:chart-securityBefore

After

Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
Medium Risk
Changes default pod security posture and container user for all Helm/Docker deploys; misconfiguration could break workloads that assumed root or a writable root FS, though
/tmpis explicitly provided.Overview
Hardens Kubernetes deployments by default: the Helm chart now ships restricted pod and container security contexts (non-root UID/GID 10001, dropped capabilities, read-only root filesystem) and always mounts a writable
/tmpemptyDirso the server can run under those constraints.Production and dev Docker images match that runtime: they set
HOME=/tmp, create user10001:10001, and run the Node process as that user instead of root.CI gains path-gated
chart-checks(Helm deps + lint when chart/Dockerfile paths change) and folds the result into the aggregatecheckjob. Chart README documents the new defaults and the/tmpmount.Reviewed by Cursor Bugbot for commit 4663963. Bugbot is set up for automated code reviews on this repo. Configure here.