Skip to content

Commit f4735e6

Browse files
jespinoona-agent
andcommitted
Trying with postCreateCommand
Co-authored-by: Ona <[email protected]>
1 parent e3d2793 commit f4735e6

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,3 @@ FROM mcr.microsoft.com/devcontainers/typescript-node:latest
33
# Disable npm/yarn lifecycle scripts for security
44
RUN npm config set ignore-scripts true --location=user && \
55
echo 'ignore-scripts true' >> ~/.yarnrc
6-
7-
# Disable npx for security
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"

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"features": {
99
"ghcr.io/devcontainers/features/node:1": {}
1010
},
11-
"postCreateCommand": "yarn install --frozen-lockfile",
11+
"postCreateCommand": "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\" && yarn install --frozen-lockfile",
1212
"customizations": {
1313
"vscode": {
1414
"extensions": ["esbenp.prettier-vscode"]

0 commit comments

Comments
 (0)