From 504d3e19e02981df3aff68ee5e11f72a2b647676 Mon Sep 17 00:00:00 2001 From: Vaibhav Zope Date: Thu, 20 Aug 2026 14:40:24 +0530 Subject: [PATCH] fix(agent-bot): run as non-root bun user Drop root in the container so a compromised process cannot own the whole container filesystem (CWE-250). Files copied with --chown=bun:bun and /app is chowned before the USER switch so bun install still writes node_modules. Closes #39 --- agent-bot/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agent-bot/Dockerfile b/agent-bot/Dockerfile index 4cd1f20..6251f01 100644 --- a/agent-bot/Dockerfile +++ b/agent-bot/Dockerfile @@ -3,12 +3,14 @@ FROM oven/bun:1.3-alpine WORKDIR /app -COPY agent-bot/package.json ./agent-bot/ +RUN chown bun:bun /app +USER bun +COPY --chown=bun:bun agent-bot/package.json ./agent-bot/ RUN cd agent-bot && bun install # Preserve the repo layout so `../../shared/bot-prompt` resolves the same in the image and locally. -COPY shared ./shared -COPY agent-bot/src ./agent-bot/src +COPY --chown=bun:bun shared ./shared +COPY --chown=bun:bun agent-bot/src ./agent-bot/src ENV PORT=4200 EXPOSE 4200