Skip to content

Commit 79937bf

Browse files
jespinoona-agent
andcommitted
Use dynamic npx path detection instead of hardcoded paths
Replace hardcoded /usr/bin/npx and /usr/local/bin/npx with $(which npx) to handle different npx installation locations. Co-authored-by: Ona <[email protected]>
1 parent f98e706 commit 79937bf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ RUN npm config set ignore-scripts true --location=user && \
55
echo 'ignore-scripts true' >> ~/.yarnrc
66

77
# Disable npx for security
8-
RUN rm -f /usr/bin/npx /usr/local/bin/npx && \
9-
echo '#!/bin/sh' > /usr/local/bin/npx && \
10-
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> /usr/local/bin/npx && \
11-
echo 'exit 1' >> /usr/local/bin/npx && \
12-
chmod +x /usr/local/bin/npx
8+
RUN NPX_PATH=$(which npx) && \
9+
rm -f "$NPX_PATH" && \
10+
echo '#!/bin/sh' > "$NPX_PATH" && \
11+
echo 'echo "npx is disabled for security reasons. Use explicit package installation instead." >&2' >> "$NPX_PATH" && \
12+
echo 'exit 1' >> "$NPX_PATH" && \
13+
chmod +x "$NPX_PATH"

0 commit comments

Comments
 (0)