Skip to content

Conversation

@jespino
Copy link
Contributor

@jespino jespino commented Dec 4, 2025

Disable npm/yarn lifecycle scripts and npx in the devcontainer for security.

Changes

  • Create .devcontainer/Dockerfile with security configurations
  • Update .devcontainer/devcontainer.json to use the new Dockerfile

Security configurations

  • npm config set ignore-scripts true - disables npm lifecycle scripts
  • ignore-scripts true in .yarnrc - disables yarn lifecycle scripts
  • Replace npx binary with error message stub

Fixes PDE-183

- Create Dockerfile with ignore-scripts configuration for npm/yarn
- Disable npx with informative error message
- Update devcontainer.json to use the new Dockerfile

Fixes PDE-183

Co-authored-by: Ona <no-reply@ona.com>
@jespino jespino force-pushed the jesus/pde-183-disable-npm-lifecycle-scripts-in-gitpod-sdk-typescript branch from 481ec5c to f98e706 Compare December 4, 2025 16:06
echo 'ignore-scripts true' >> ~/.yarnrc

# Disable npx for security
RUN rm -f /usr/bin/npx /usr/local/bin/npx && \
Copy link
Member

Choose a reason for hiding this comment

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

image

We could use $(which npx) to make this more reliable across repos

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm updating this here, and in other PRs

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

jespino and others added 2 commits December 9, 2025 13:06
Replace hardcoded /usr/bin/npx and /usr/local/bin/npx with $(which npx)
to handle different npx installation locations.

Co-authored-by: Ona <no-reply@ona.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants