Skip to content

Commit 0d3499d

Browse files
committed
fix vulnerabilities and scan to CI
1 parent e309f21 commit 0d3499d

File tree

4 files changed

+50
-28
lines changed

4 files changed

+50
-28
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,25 @@ jobs:
4141
- name: Run tests (mcp-shared)
4242
run: npm run test -- --run
4343
working-directory: packages/mcp-shared
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Build truvera-api image for scanning
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
file: ./apps/truvera-api/Dockerfile
53+
load: true
54+
tags: truvera-api-mcp:ci
55+
build-args: |
56+
BUILD_NUMBER=${{ github.run_number }}
57+
58+
- name: Scan truvera-api image for HIGH and CRITICAL vulnerabilities
59+
uses: aquasecurity/trivy-action@v0.35.0
60+
with:
61+
image-ref: truvera-api-mcp:ci
62+
format: table
63+
ignore-unfixed: true
64+
severity: HIGH,CRITICAL
65+
exit-code: '1'

apps/truvera-api/Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Multi-stage build for Truvera MCP Service
22
ARG BUILD_NUMBER=1
33

4-
FROM node:22-alpine3.21 AS builder
4+
FROM node:22-alpine3.22 AS builder
55

66
ARG BUILD_NUMBER
77

@@ -11,9 +11,6 @@ WORKDIR /app
1111
RUN apk update && apk upgrade --no-cache && \
1212
apk add --no-cache openssl
1313

14-
# Upgrade npm
15-
RUN npm install -g npm@11.6.4 --no-fund --no-audit
16-
1714
# Copy root package files for workspace
1815
COPY package*.json ./
1916

@@ -39,17 +36,14 @@ COPY apps/truvera-api/tsconfig.json ./apps/truvera-api/
3936
RUN BUILD_NUMBER=$BUILD_NUMBER npm run build --workspace=apps/truvera-api
4037

4138
# Runtime stage
42-
FROM node:22-alpine3.21
39+
FROM node:22-alpine3.22
4340

4441
WORKDIR /app
4542

4643
# Upgrade system packages to fix security vulnerabilities
4744
RUN apk update && apk upgrade --no-cache && \
4845
apk add --no-cache openssl
4946

50-
# Upgrade npm in the runtime image too (keeps logs consistent)
51-
RUN npm install -g npm@11.6.4 --no-fund --no-audit
52-
5347
# Copy root package files
5448
COPY package*.json ./
5549

@@ -58,7 +52,7 @@ COPY packages/mcp-shared/package*.json ./packages/mcp-shared/
5852
COPY apps/truvera-api/package*.json ./apps/truvera-api/
5953

6054
# Install production dependencies only
61-
RUN npm ci --workspaces --only=production
55+
RUN npm ci --workspaces --omit=dev
6256

6357
# Copy built shared package from builder
6458
COPY --from=builder /app/packages/mcp-shared/dist ./packages/mcp-shared/dist

package-lock.json

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
"packages/*",
2222
"apps/*"
2323
],
24+
"overrides": {
25+
"@hono/node-server": "^1.19.12",
26+
"express-rate-limit": "^8.3.2",
27+
"hono": "^4.12.11",
28+
"path-to-regexp": "^8.4.2"
29+
},
2430
"engines": {
2531
"node": ">=18.0.0",
2632
"npm": ">=8.0.0"

0 commit comments

Comments
 (0)