Skip to content

Commit 7534d75

Browse files
authored
Merge pull request #504 from ansforge/fix/scan-images-lrm
fix(lrm): fix LRM high/critical CVE
2 parents 2932cb6 + 6785786 commit 7534d75

File tree

11 files changed

+3967
-3674
lines changed

11 files changed

+3967
-3674
lines changed

.github/config/build-matrices.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
# Example: lrm-1.2.3, chatbot-2.1.0-beta
44

55
projects:
6-
lrm:
7-
description: "LRM project - includes both backend and frontend components"
8-
include:
9-
- name: lrm-backend
10-
context: ./web/lrm/server
11-
tag: hub-lrm-back
12-
artifact-name: trivy-reports-lrm-backend
13-
- name: lrm-frontend
14-
context: ./web/lrm/client
15-
tag: hub-lrm-front
16-
artifact-name: trivy-reports-lrm-frontend
17-
186
landing:
197
description: "Landing page web component"
208
include:

.github/workflows/build-images.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: Build images (lrm, landing, healthcheck, chatbot, openSSL, specs, annuaire)
1+
name: Build images (landing, healthcheck, chatbot, openSSL, specs, annuaire)
22

33
on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- 'lrm-*'
87
- 'landing-*'
98
- 'healthcheck-*'
109
- 'chatbot-*'

.github/workflows/lrm-build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build LRM images
2+
on:
3+
push:
4+
tags:
5+
- 'lrm-*'
6+
workflow_dispatch:
7+
jobs:
8+
get-tag:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version: ${{ steps.extract-lrm-version.outputs.version }}
12+
steps:
13+
- name: Extract version from tag
14+
id: extract-lrm-version
15+
run: |
16+
TAG_NAME="${{ github.ref_name }}"
17+
VERSION=${TAG_NAME#lrm-}
18+
PATTERN="^([0-9]+\.[0-9]+(\.[0-9]+)?)(-[A-Za-z0-9\.]+)*$"
19+
if [[ ! "$VERSION" =~ $PATTERN ]]; then
20+
echo "Invalid version number"
21+
echo $VERSION
22+
exit 1
23+
fi
24+
echo "version=$VERSION" >> $GITHUB_OUTPUT
25+
26+
build-images:
27+
needs: get-tag
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
include:
32+
- name: 'hub-lrm-back'
33+
context: './web/lrm/server'
34+
- name: 'hub-lrm-front'
35+
context: './web/lrm/client'
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v5
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
- name: Login to Container Registry
43+
uses: docker/login-action@v3
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v6
50+
with:
51+
push: true
52+
platforms: linux/amd64
53+
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ needs.get-tag.outputs.version }}
54+
context: ${{ matrix.context }}
55+
56+
image-security-scan:
57+
name: Scan Docker Images
58+
needs: [get-tag, build-images]
59+
runs-on: ubuntu-latest
60+
continue-on-error: true
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
include:
65+
- name: 'hub-lrm-back'
66+
folder: './web/lrm/server'
67+
- name: 'hub-lrm-front'
68+
folder: './web/lrm/client'
69+
steps:
70+
- name: Checkout
71+
uses: actions/checkout@v5
72+
- name: Login to Container Registry
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.actor }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
- name: Scan Dispatcher Docker image
79+
uses: aquasecurity/trivy-action@0.33.1
80+
with:
81+
image-ref: 'ghcr.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ needs.get-tag.outputs.version }}'
82+
format: 'table'
83+
severity: 'HIGH,CRITICAL'
84+
exit-code: '1'
85+
trivyignores: '${{ matrix.folder }}/.trivyignore'

web/lrm/client/.trivyignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Trivy ignore file for LRM client image
2+
3+
# glob vulnerability - current 10.4.5 & 11.0.3 - fixed in 11.1.0, 10.5.0 (not available in the latest node 24 images)
4+
CVE-2025-64756
5+
6+
# stdlib vulnerabilities - current 1.23.12 - fixed in 1.24.11, 1.25.5
7+
# the stdlib version corresponds to the Go version used in the esbuild package
8+
# it appears that versions >= 0.27 of esbuild use the correct Go version (the version correspondence is not explicit)
9+
# the latest release version of nitropack, which is a dependency of @nuxt/nitro-server, itself a dependency of nuxt, uses version 0.25 of esbuild
10+
# the latest alpha release of nitropack (v3-alpha.1) does not seem to use esbuild, so upgrading to v3 when stable should fix the issue
11+
CVE-2025-58183
12+
CVE-2025-61729

web/lrm/client/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ COPY . .
1616
# Build the project
1717
RUN npm run build
1818

19+
# Clean up npm and cache after build
20+
RUN npm cache clean --force && \
21+
rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx
22+
1923
# 2. Start
2024
FROM node:24.11-alpine AS runner
2125

@@ -36,6 +40,10 @@ RUN adduser -S app -u 1001 -G app
3640
# Change ownership of the app directory to the non-root user
3741
RUN chown -R app:app /app
3842

43+
# Remove npm from the final image to avoid shipping bundled vulnerable
44+
# packages (some base images include npm and its dependencies like tar)
45+
RUN rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx || true
46+
3947
ENV NUXT_HOST=0.0.0.0
4048
ENV NUXT_PORT=3000
4149

@@ -45,5 +53,5 @@ EXPOSE 3000
4553
# Switch to non-root user
4654
USER app
4755

48-
# Start the web app
49-
CMD ["npm", "start"]
56+
# Start the web app directly with node (avoid runtime npm dependency)
57+
CMD ["node", ".output/server/index.mjs"]

0 commit comments

Comments
 (0)