Skip to content

fix: SECURITY FIX! Add Trivy vulnerability scanner and mitigate security issues - #10949

Closed
codearranger wants to merge 2 commits into
LibreChat-AI:mainfrom
codearranger:security
Closed

codearranger wants to merge 2 commits into
LibreChat-AI:mainfrom
codearranger:security

Conversation

@codearranger

@codearranger codearranger commented Dec 12, 2025 •

Copy link
Copy Markdown

Summary

This PR adds a Trivy vulnerability scanner GitHub Actions workflow and mitigates all security vulnerabilities identified by it.

Security Fixes

CVE Severity Package Fix
CVE-2025-66414 HIGH @modelcontextprotocol/sdk Upgraded 1.21.0 → 1.24.0
CVE-2024-21538 HIGH cross-spawn Docker base image upgrade to node:22-alpine
CVE-2025-64756 HIGH glob Docker base image upgrade + npm upgrade
CVE-2025-13466 MEDIUM body-parser Added npm override to ^2.2.1
CVE-2025-5889 LOW brace-expansion Docker base image upgrade to node:22-alpine

Changes

  • Add Trivy vulnerability scanner GitHub Actions workflow (.github/workflows/trivy.yml)
  • Upgrade @modelcontextprotocol/sdk from ^1.21.0 to ^1.24.0 in api/package.json and packages/api/package.json
  • Add body-parser override to ^2.2.1 in root package.json
  • Upgrade Docker base image from node:20-alpine to node:22-alpine in Dockerfile and Dockerfile.multi
  • Add npm install -g npm@latest to Dockerfiles to fix glob CLI vulnerability

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  1. Run npm audit - shows 0 vulnerabilities
  2. Build Docker image and run Trivy scan - all vulnerabilities resolved
  3. Run npm run test:api - backend tests pass
  4. Application functionality unchanged

Test Configuration

  • Node.js 22.x (Docker)
  • npm 10.x+

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

Add GitHub Actions workflow for Trivy vulnerability scanning and fix
all identified security vulnerabilities:

- CVE-2025-66414 (HIGH): Upgrade @modelcontextprotocol/sdk to ^1.24.0
- CVE-2024-21538 (HIGH): Fix cross-spawn via node:22-alpine base image
- CVE-2025-64756 (HIGH): Mitigate glob CLI injection via base image upgrade
- CVE-2025-13466 (MEDIUM): Add body-parser override to ^2.2.1
- CVE-2025-5889 (LOW): Fix brace-expansion via node:22-alpine base image

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codearranger

Copy link
Copy Markdown
Author

@danny-avila Can you please approve the workflows?

@codearranger codearranger changed the title fix: Add Trivy vulnerability scanner and mitigate security issues fix: SECURITY FIX! Add Trivy vulnerability scanner and mitigate security issues Dec 14, 2025
Comment thread package.json
}
}
},
"body-parser": "^2.2.1"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary, already addressed

Comment thread Dockerfile.multi
# Install jemalloc
RUN apk add --no-cache jemalloc
# Upgrade npm to fix CVE-2025-64756 (glob command injection)
RUN npm install -g npm@latest

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not an acceptable command, as this could silently change how packages work

Comment thread Dockerfile
RUN apk add --no-cache python3 py3-pip uv

# Upgrade npm to fix CVE-2025-64756 (glob command injection)
RUN npm install -g npm@latest

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not an acceptable command, as this could silently change how packages work

Comment thread Dockerfile

# Base node image
FROM node:20-alpine AS node
FROM node:22-alpine AS node

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node v22 has issues with some of our dependencies, we would need to test in a separate PR

@github-advanced-security

Copy link
Copy Markdown
Contributor

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@danny-avila

Copy link
Copy Markdown
Collaborator

@modelcontextprotocol/sdk | Upgraded 1.21.0 → 1.24.0
body-parser Added npm override to ^2.2.1
brace-expansion

These items are already addressed.

Docker base image upgrade to node:22-alpine

node v22 would not be compatible with our OpenID SDK dependency, likely would need to test node v24 as the solution here.

This PR adds a Trivy vulnerability scanner GitHub Actions workflow

I would appreciate this as its own workflow, and separate any docker image edits as well to their own workflow, as well as the reasoning for using Trivy as opposed to another automated security scan tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants