Skip to content

Commit ccae376

Browse files
jespinoona-agent
andcommitted
Disable npm lifecycle scripts and npx for security
- Add npm/yarn ignore-scripts config to Dockerfile - Disable npx with a stub that shows an error message - Add --ignore-scripts flag to npm install Related to PDE-128 Co-authored-by: Ona <no-reply@ona.com>
1 parent 7ad27b9 commit ccae376

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gitpod/gitpod.Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
FROM gitpod/workspace-full:latest
22

3+
# Disable npm lifecycle scripts and npx for security
4+
RUN npm config set ignore-scripts true --location=user && \
5+
echo 'ignore-scripts true' >> ~/.yarnrc && \
6+
rm -f /usr/bin/npx /usr/local/bin/npx && \
7+
echo '#!/bin/sh' > /usr/local/bin/npx && \
8+
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \
9+
echo 'exit 1' >> /usr/local/bin/npx && \
10+
chmod +x /usr/local/bin/npx
11+
312
# Cache firebase
4-
RUN npm install --global npm firebase firebase-tools
13+
RUN npm install --global --ignore-scripts npm firebase firebase-tools

0 commit comments

Comments
 (0)