Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ image: jeanp413/python-test-workspace
tasks:
- name: Init workspace
init: |
NPX_PATH=$(which npx) && sudo rm -f "$NPX_PATH" && echo '#!/bin/sh' | sudo tee "$NPX_PATH" > /dev/null && echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' | sudo tee -a "$NPX_PATH" > /dev/null && echo 'exit 1' | sudo tee -a "$NPX_PATH" > /dev/null && sudo chmod +x "$NPX_PATH"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sames as here.

mkdir node_modules
cp -r /home/gitpod/.cache/workspace/* ./node_modules
yarn --ignore-scripts
Expand Down
10 changes: 2 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
FROM gitpod/workspace-full

# Disable npm lifecycle scripts and npx for security
# Disable npm lifecycle scripts for security
RUN npm config set ignore-scripts true --location=user && \
echo 'ignore-scripts true' >> ~/.yarnrc && \
NPX_PATH=$(which npx) && \
rm -f "$NPX_PATH" && \
echo '#!/bin/sh' > "$NPX_PATH" && \
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> "$NPX_PATH" && \
echo 'exit 1' >> "$NPX_PATH" && \
chmod +x "$NPX_PATH"
echo 'ignore-scripts true' >> ~/.yarnrc

# Create a new image and publish it to dockerhub, then use it directly in .gitpod.yml
# as prebuils for integration test makes no sense because a new environment is created
Expand Down