-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Replace npx with pinned npm-tools and add security hardening #21166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
e168a9c
2897ffa
22f22b7
a1f2efa
8fe30fd
abac094
f15e31b
11c9a0a
7f2dcb5
1fcaecb
d543b64
fdb7c7b
fae8573
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | | |
| && nvm alias default v${NODE_VERSION} \ | ||
| && npm install -g typescript yarn pnpm node-gyp @anthropic-ai/claude-code" | ||
|
|
||
| # Disable npm/yarn lifecycle scripts by default (security hardening) | ||
| # To allow specific packages, use: npm rebuild <package> or yarn rebuild <package> | ||
| RUN npm config set ignore-scripts true --location=user && \ | ||
|
||
| echo 'ignore-scripts true' >> ~/.yarnrc | ||
|
|
||
| # Disable npx (security hardening - prevents arbitrary package execution) | ||
| RUN rm -f /usr/bin/npx /usr/local/bin/npx && \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. npx is also located as part of the nvm installation, we should remove it from here too: Evidence: |
||
| echo '#!/bin/sh' > /usr/local/bin/npx && \ | ||
| echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Works: |
||
| echo 'exit 1' >> /usr/local/bin/npx && \ | ||
| chmod +x /usr/local/bin/npx | ||
kylos101 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ENV PATH=$PATH:/root/.aws-iam:/root/.terraform:/workspace/bin | ||
|
|
||
| ### Telepresence ### | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built the image like: