Skip to content

fix(security): set readOnlyRootFilesystem on bot container (RHCLOUD-50068) - #88

Open
tahmidefaz wants to merge 1 commit into
RedHatInsights:masterfrom
tahmidefaz:rhcloud-50068-readonly-rootfs
Open

tahmidefaz wants to merge 1 commit into
RedHatInsights:masterfrom
tahmidefaz:rhcloud-50068-readonly-rootfs

Conversation

@tahmidefaz

@tahmidefaz tahmidefaz commented Aug 19, 2026

Copy link
Copy Markdown
Member

Issue

RHCLOUD-50068 (FIND-004, from the AI security audit): the bot container's securityContext didn't set readOnlyRootFilesystem: true. A fully writable root filesystem means any code executed inside the container (e.g. a malicious npm postinstall script) could overwrite binaries on PATH or drop persistence inside the container image layer — this would survive for the pod's lifetime.

Changes

  • readOnlyRootFilesystem: true on the bot container — this is the actual fix.
  • home and tmp emptyDir volumes, mounted at /home/botuser and /tmp. The bot legitimately needs writable scratch space — git clones under /home/botuser/app/repos, .gitconfig-gh/.gitconfig-gl, .credentials, temp files via mktemp. Locking the rootfs without giving it somewhere to write would break the entrypoint outright, so these paths are backed by emptyDir instead. Sized at 6Gi/2Gi to stay within the existing 8Gi ephemeral-storage limit on the container.
  • init-home init container: runs cp -a /home/botuser/. /mnt/home/ to seed the home emptyDir with the image's baked-in content (python venv, bot code, config.json, .mcp.json, entrypoint.sh, etc.) before the main container starts. Without this, mounting a bare emptyDir over /home/botuser would hide everything baked into the image at build time and the bot would boot into an empty home directory.

Net effect: same runtime behavior as before, but the container's root filesystem is now locked down and all writes are confined to the two explicit volumes.

…0068)

FIND-004: writable rootfs let executed third-party code (npm postinstall
etc.) overwrite PATH binaries or persist inside the image layer. Lock the
rootfs and move writable state (HOME, /tmp) to emptyDir volumes, sized
within the existing ephemeral-storage limit. An init container seeds the
home volume with the image's baked-in venv/bot code/config first, since a
bare emptyDir mount would otherwise hide that content.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant