Skip to content

Fixes #420: Harden Helm chart security defaults - #434

Merged
chiragjn merged 3 commits into
truefoundry:mainfrom
rohanmalhotracodes:helm
Aug 26, 2026
Merged

chiragjn merged 3 commits into
truefoundry:mainfrom
rohanmalhotracodes:helm

Conversation

@rohanmalhotracodes

@rohanmalhotracodes rohanmalhotracodes commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

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 /tmp as writable storage so readOnlyRootFilesystem: true works.

Closes #420

Changes

  • Added non-root runtime user 10001:10001 in Dockerfile and Dockerfile.dev
  • Added secure default podSecurityContext and container securityContext
  • Added default /tmp emptyDir volume mount for writable temp storage
  • Added chart render coverage for the Deployment security context
  • Added Helm chart CI checks for chart changes
  • Updated chart README with the new security defaults

How was this tested?

  • pnpm build
  • pnpm test
  • pnpm typecheck
  • pnpm lint:ci
  • pnpm chart:deps
  • pnpm chart:lint
  • pnpm chart:template
  • pnpm test:chart-security

Before
main-before

After
helm-after

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Changes default pod runtime identity, filesystem writability, and resource limits for Helm installs; upgrades may need values overrides if workloads relied on root or empty resource defaults.

Overview
Hardens TrueForge Kubernetes deployments by aligning container images and the Helm chart with restricted security defaults (closes #420).

Docker images (Dockerfile, Dockerfile.dev) now create user/group 10001 and run the server process as non-root instead of root.

Helm chart defaults add pod-level runAsNonRoot / UID 10001, container readOnlyRootFilesystem, dropped capabilities, and concrete CPU/memory/ephemeral-storage requests and limits. The Deployment always mounts a writable /tmp emptyDir (optionally sized from resources.limits.ephemeral-storage) so read-only root filesystem still works.

CI path-filters chart-related changes and runs a gated chart-checks job (pnpm chart:deps, pnpm chart:lint); the aggregate check job treats skipped/success chart checks like other optional suites. Chart README documents the new defaults and /tmp behavior.

Reviewed by Cursor Bugbot for commit b58347d. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b58347d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chiragjn chiragjn self-assigned this Aug 26, 2026
Comment thread Dockerfile Resolved
Comment thread Dockerfile Resolved
Comment thread Dockerfile.dev Resolved
Comment thread Dockerfile.dev Resolved
@chiragjn
chiragjn merged commit 7c63b3a into truefoundry:main Aug 26, 2026
10 checks passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b58347d. Configure here.

limits:
cpu: 200m
memory: 512Mi
ephemeral-storage: 512Mi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default limits override custom requests

High Severity

Helm deep-merges these new default resources.limits into user values that only set resources.requests. If those requests exceed 200m CPU or 512Mi memory, the pod spec is invalid (request > limit) and the Deployment is rejected. That matches the previous “set CPU requests before HPA” path, so a typical requests-only override or chart upgrade can fail to roll out.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b58347d. Configure here.

@rohanmalhotracodes
rohanmalhotracodes deleted the helm branch August 27, 2026 18:28
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.

Helm chart ships no default securityContext — server container runs as root with full capabilities

2 participants