Skip to content

Commit e7714f0

Browse files
Krish Dholakiaclaude
andauthored
Fix CVEs: bump tar/minimatch/pypdf + harden Docker SBOM patching (#23082)
* fix(docker): bump tar/minimatch/pypdf for CVE fixes + harden SBOM patching - Bump tar 7.5.8→7.5.10, minimatch 10.2.1→10.2.4, pypdf 6.6.2→6.7.3 - Add sed-based SBOM metadata patching with properly indented find/sed - Add npm package manager cleanup (apk del / apt-get purge) to remove stale SBOM entries from image scanners - Scope || true to only apk del via brace grouping { ... || true; } - Guard npm root -g with non-empty assertion to prevent silent failures - Scope minimatch sed regex to ^10.x to avoid matching other major versions Addresses: CVE-2026-27903, CVE-2026-27904, GHSA-qffp-2rhf-9h96, CVE-2026-27888 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(docker): scope find to /usr/local/lib /usr/lib, drop autoremove - Replace `find /` with `find /usr/local/lib /usr/lib` to avoid traversing /proc, /sys, /dev during SBOM metadata patching - Remove `apt-get autoremove -y` from Debian-based Dockerfiles to prevent nodejs from being removed as an auto-installed dependency Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ec9791f commit e7714f0

File tree

12 files changed

+46
-22
lines changed

12 files changed

+46
-22
lines changed

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ USER root
4949

5050
# Install runtime dependencies (libsndfile needed for audio processing on ARM64)
5151
RUN apk add --no-cache bash openssl tzdata nodejs npm python3 py3-pip libsndfile && \
52-
npm install -g npm@latest tar@7.5.8 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 && \
52+
npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 && \
5353
# SECURITY FIX: npm bundles tar, glob, and brace-expansion at multiple nested
5454
# levels inside its dependency tree. `npm install -g <pkg>` only creates a
5555
# SEPARATE global package, it does NOT replace npm's internal copies.
@@ -70,7 +70,15 @@ RUN apk add --no-cache bash openssl tzdata nodejs npm python3 py3-pip libsndfile
7070
find "$GLOBAL/npm" -type d -name "diff" -path "*/node_modules/diff" | while read d; do \
7171
rm -rf "$d" && cp -rL "$GLOBAL/diff" "$d"; \
7272
done && \
73-
npm cache clean --force
73+
# SECURITY FIX: patch npm's own package.json metadata so scanners see the
74+
# actual installed versions instead of the stale declared dependencies.
75+
find /usr/local/lib /usr/lib -path "*/node_modules/npm/package.json" -exec \
76+
sed -i 's/"tar": "\^7\.5\.[0-9]*"/"tar": "^7.5.10"/g; s/"minimatch": "\^10\.[0-9.]*"/"minimatch": "^10.2.4"/g' {} + 2>/dev/null && \
77+
npm cache clean --force && \
78+
# Remove the apk-tracked npm so its stale SBOM metadata (tar 7.5.9) is
79+
# no longer visible to image scanners. The globally installed npm@latest
80+
# at /usr/local/lib/node_modules/npm/ remains fully functional.
81+
{ apk del --no-cache npm 2>/dev/null || true; }
7482

7583
WORKDIR /app
7684
# Copy the current directory contents into the container at /app
@@ -96,6 +104,7 @@ RUN find /usr/lib -type f -path "*/tornado/test/*" -delete && \
96104
# npm with old vulnerable deps at /usr/lib/python3.*/site-packages/nodejs_wheel/.
97105
# Patch every copy of tar, glob, and brace-expansion inside that tree.
98106
RUN GLOBAL="$(npm root -g)" && \
107+
[ -n "$GLOBAL" ] || { echo "ERROR: npm root -g returned empty; aborting"; exit 1; } && \
99108
find /usr/lib -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
100109
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
101110
done && \

docker/Dockerfile.custom_ui

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN apt-get update && apt-get upgrade -y \
1919
libgnutls30 \
2020
libc6 && \
2121
apt-get install -y nodejs npm && \
22-
npm install -g npm@latest tar@7.5.8 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.1 diff@8.0.3 && \
22+
npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 && \
2323
GLOBAL="$(npm root -g)" && \
2424
find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
2525
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
@@ -36,7 +36,10 @@ RUN apt-get update && apt-get upgrade -y \
3636
find "$GLOBAL/npm" -type d -name "diff" -path "*/node_modules/diff" | while read d; do \
3737
rm -rf "$d" && cp -rL "$GLOBAL/diff" "$d"; \
3838
done && \
39-
npm cache clean --force
39+
find /usr/local/lib /usr/lib -path "*/node_modules/npm/package.json" -exec \
40+
sed -i 's/"tar": "\^7\.5\.[0-9]*"/"tar": "^7.5.10"/g; s/"minimatch": "\^10\.[0-9.]*"/"minimatch": "^10.2.4"/g' {} + 2>/dev/null && \
41+
npm cache clean --force && \
42+
apt-get purge -y npm
4043

4144
# Copy the UI source into the container
4245
COPY ./ui/litellm-dashboard /app/ui/litellm-dashboard

docker/Dockerfile.database

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ USER root
5050

5151
# Install runtime dependencies
5252
RUN apk add --no-cache bash openssl tzdata nodejs npm python3 py3-pip libsndfile && \
53-
npm install -g npm@latest tar@7.5.8 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.1 diff@8.0.3 && \
53+
npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 && \
5454
GLOBAL="$(npm root -g)" && \
5555
find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
5656
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
@@ -67,7 +67,10 @@ RUN apk add --no-cache bash openssl tzdata nodejs npm python3 py3-pip libsndfile
6767
find "$GLOBAL/npm" -type d -name "diff" -path "*/node_modules/diff" | while read d; do \
6868
rm -rf "$d" && cp -rL "$GLOBAL/diff" "$d"; \
6969
done && \
70-
npm cache clean --force
70+
find /usr/local/lib /usr/lib -path "*/node_modules/npm/package.json" -exec \
71+
sed -i 's/"tar": "\^7\.5\.[0-9]*"/"tar": "^7.5.10"/g; s/"minimatch": "\^10\.[0-9.]*"/"minimatch": "^10.2.4"/g' {} + 2>/dev/null && \
72+
npm cache clean --force && \
73+
{ apk del --no-cache npm 2>/dev/null || true; }
7174

7275
WORKDIR /app
7376
# Copy the current directory contents into the container at /app
@@ -85,6 +88,7 @@ RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl
8588
# npm with old vulnerable deps at /usr/lib/python3.*/site-packages/nodejs_wheel/.
8689
# Patch every copy of tar, glob, and brace-expansion inside that tree.
8790
RUN GLOBAL="$(npm root -g)" && \
91+
[ -n "$GLOBAL" ] || { echo "ERROR: npm root -g returned empty; aborting"; exit 1; } && \
8892
find /usr/lib -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
8993
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
9094
done && \

docker/Dockerfile.dev

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ RUN apt-get update && apt-get upgrade -y \
7575
nodejs \
7676
npm \
7777
&& rm -rf /var/lib/apt/lists/* \
78-
&& npm install -g npm@latest tar@7.5.8 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.1 diff@8.0.3 \
78+
&& npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 \
7979
&& GLOBAL="$(npm root -g)" \
8080
&& find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
8181
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
@@ -92,7 +92,10 @@ RUN apt-get update && apt-get upgrade -y \
9292
&& find "$GLOBAL/npm" -type d -name "diff" -path "*/node_modules/diff" | while read d; do \
9393
rm -rf "$d" && cp -rL "$GLOBAL/diff" "$d"; \
9494
done \
95-
&& npm cache clean --force
95+
&& find /usr/local/lib /usr/lib -path "*/node_modules/npm/package.json" -exec \
96+
sed -i 's/"tar": "\^7\.5\.[0-9]*"/"tar": "^7.5.10"/g; s/"minimatch": "\^10\.[0-9.]*"/"minimatch": "^10.2.4"/g' {} + 2>/dev/null \
97+
&& npm cache clean --force \
98+
&& apt-get purge -y npm
9699

97100
WORKDIR /app
98101

@@ -114,6 +117,7 @@ RUN pip install --no-cache-dir *.whl /wheels/* --no-index --find-links=/wheels/
114117
# npm with old vulnerable deps at /usr/lib/python3.*/site-packages/nodejs_wheel/.
115118
# Patch every copy of tar, glob, and brace-expansion inside that tree.
116119
RUN GLOBAL="$(npm root -g)" && \
120+
[ -n "$GLOBAL" ] || { echo "ERROR: npm root -g returned empty; aborting"; exit 1; } && \
117121
find /usr/lib -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
118122
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
119123
done && \

docker/Dockerfile.non_root

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ RUN for i in 1 2 3; do \
106106
apk add --no-cache python3 py3-pip bash openssl tzdata nodejs npm supervisor && break || sleep 5; \
107107
done \
108108
&& apk upgrade --no-cache nodejs \
109-
&& npm install -g npm@latest tar@7.5.8 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.1 diff@8.0.3 \
109+
&& npm install -g npm@latest tar@7.5.10 glob@11.1.0 @isaacs/brace-expansion@5.0.1 minimatch@10.2.4 diff@8.0.3 \
110110
&& GLOBAL="$(npm root -g)" \
111111
&& find "$GLOBAL/npm" -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
112112
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
@@ -123,7 +123,10 @@ RUN for i in 1 2 3; do \
123123
&& find "$GLOBAL/npm" -type d -name "diff" -path "*/node_modules/diff" | while read d; do \
124124
rm -rf "$d" && cp -rL "$GLOBAL/diff" "$d"; \
125125
done \
126-
&& npm cache clean --force
126+
&& find /usr/local/lib /usr/lib -path "*/node_modules/npm/package.json" -exec \
127+
sed -i 's/"tar": "\^7\.5\.[0-9]*"/"tar": "^7.5.10"/g; s/"minimatch": "\^10\.[0-9.]*"/"minimatch": "^10.2.4"/g' {} + 2>/dev/null \
128+
&& npm cache clean --force \
129+
&& { apk del --no-cache npm 2>/dev/null || true; }
127130

128131
# Copy artifacts from builder
129132
COPY --from=builder /app/requirements.txt /app/requirements.txt
@@ -169,6 +172,7 @@ RUN pip install --no-index --find-links=/wheels/ -r requirements.txt && \
169172
# npm with old vulnerable deps at /usr/lib/python3.*/site-packages/nodejs_wheel/.
170173
# Patch every copy of tar, glob, and brace-expansion inside that tree.
171174
RUN GLOBAL="$(npm root -g)" && \
175+
[ -n "$GLOBAL" ] || { echo "ERROR: npm root -g returned empty; aborting"; exit 1; } && \
172176
find /usr/lib -type d -name "tar" -path "*/node_modules/tar" | while read d; do \
173177
rm -rf "$d" && cp -rL "$GLOBAL/tar" "$d"; \
174178
done && \

docs/my-website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"mermaid": ">=11.10.0",
6262
"gray-matter": "4.0.3",
6363
"glob": ">=11.1.0",
64-
"tar": ">=7.5.8",
64+
"tar": ">=7.5.10",
6565
"minimatch": ">=10.2.4",
6666
"diff": ">=8.0.3",
6767
"@isaacs/brace-expansion": ">=5.0.1",

litellm-js/spend-logs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
},
1313
"overrides": {
1414
"glob": ">=11.1.0",
15-
"tar": ">=7.5.8",
16-
"minimatch": ">=10.2.1",
15+
"tar": ">=7.5.10",
16+
"minimatch": ">=10.2.4",
1717
"diff": ">=8.0.3",
1818
"@isaacs/brace-expansion": ">=5.0.1",
1919
"@babel/traverse": ">=7.23.2",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
},
1313
"overrides": {
1414
"glob": ">=11.1.0",
15-
"tar": ">=7.5.8",
16-
"minimatch": ">=10.2.1",
15+
"tar": ">=7.5.10",
16+
"minimatch": ">=10.2.4",
1717
"diff": ">=8.0.3",
1818
"@isaacs/brace-expansion": ">=5.0.1",
1919
"@babel/traverse": ">=7.23.2",

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jsonschema>=4.23.0,<5.0.0 # validating json schema - aligned with openapi-core +
7575
websockets==15.0.1 # for realtime API
7676
soundfile==0.12.1 # for audio file processing
7777
openapi-core==0.21.0 # for OpenAPI compliance tests
78-
pypdf>=6.6.2 # for PDF text extraction in RAG ingestion
78+
pypdf>=6.7.3 # for PDF text extraction in RAG ingestion (CVE-2026-27888)
7979

8080
########################
8181
# LITELLM ENTERPRISE DEPENDENCIES

tests/proxy_admin_ui_tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
},
1414
"overrides": {
1515
"glob": ">=11.1.0",
16-
"tar": ">=7.5.8",
17-
"minimatch": ">=10.2.1",
16+
"tar": ">=7.5.10",
17+
"minimatch": ">=10.2.4",
1818
"diff": ">=8.0.3",
1919
"@isaacs/brace-expansion": ">=5.0.1",
2020
"@babel/traverse": ">=7.23.2",

0 commit comments

Comments
 (0)