File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -337,6 +337,18 @@ RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh |
337337 && nvm alias default v${NODE_VERSION} \
338338 && npm install -g typescript yarn pnpm node-gyp @anthropic-ai/claude-code"
339339
340+ # Disable npm/yarn lifecycle scripts by default (security hardening)
341+ # To allow specific packages, use: npm rebuild <package> or yarn rebuild <package>
342+ RUN npm config set ignore-scripts true --location=user && \
343+ echo 'ignore-scripts true' >> ~/.yarnrc
344+
345+ # Disable npx (security hardening - prevents arbitrary package execution)
346+ RUN rm -f /usr/bin/npx /usr/local/bin/npx && \
347+ echo '#!/bin/sh' > /usr/local/bin/npx && \
348+ echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \
349+ echo 'exit 1' >> /usr/local/bin/npx && \
350+ chmod +x /usr/local/bin/npx
351+
340352ENV PATH=$PATH:/root/.aws-iam:/root/.terraform:/workspace/bin
341353
342354# ## Telepresence ###
You can’t perform that action at this time.
0 commit comments