Skip to content

Commit a0dd7b0

Browse files
authored
Merge pull request #1 from gitpod-io/pde-128-disable-npm-scripts
Disable npm lifecycle scripts and npx for security
2 parents 7ad27b9 + 22202cd commit a0dd7b0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gitpod/gitpod.Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
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+
NPX_PATH=$(which npx) && \
7+
rm -f "$NPX_PATH" && \
8+
echo '#!/bin/sh' > "$NPX_PATH" && \
9+
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> "$NPX_PATH" && \
10+
echo 'exit 1' >> "$NPX_PATH" && \
11+
chmod +x "$NPX_PATH"
12+
313
# Cache firebase
4-
RUN npm install --global npm firebase firebase-tools
14+
RUN npm install --global --ignore-scripts npm firebase firebase-tools

0 commit comments

Comments
 (0)