Skip to content

Commit 478cb04

Browse files
author
aligneddev
committed
feat: Enhance security in Dockerfile by configuring npm to delay new publishes and block lifecycle scripts
1 parent eb279ca commit 478cb04

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.devcontainer/devcontainer.Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/s
1717
&& apt-get update \
1818
&& apt-get install -y --no-install-recommends podman nodejs \
1919
&& rm -rf /var/lib/apt/lists/* \
20-
&& npm --version
20+
&& npm --version \
21+
# Security hardening: delay installing very new publishes and block lifecycle scripts by default.
22+
&& npm config set --global min-release-age 1440 \
23+
&& npm config set --global ignore-scripts true
2124

2225
# Ensure the SDK version from global.json is available in the image.
2326
RUN if dotnet --list-sdks | grep -q "^${REQUIRED_DOTNET_SDK_VERSION}"; then \

src/BikeTracking.Frontend/.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Project-local npm hardening.
2+
# This complements the container's global npm config and can be tuned per-repo.
3+
min-release-age=1440
4+
ignore-scripts=true

0 commit comments

Comments
 (0)