Skip to content

fix: upgrade form-data to 2.5.4, 3.0.4, 4.0.4 (CVE-2025-7783) - #2736

Open
anupamme wants to merge 1 commit into
GladysAssistant:masterfrom
anupamme:fix-repo-gladys-cve-2025-7783-form-data
Open

fix: upgrade form-data to 2.5.4, 3.0.4, 4.0.4 (CVE-2025-7783)#2736
anupamme wants to merge 1 commit into
GladysAssistant:masterfrom
anupamme:fix-repo-gladys-cve-2025-7783-form-data

Conversation

@anupamme

@anupamme anupamme commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Upgrade form-data from 2.5.1 to 2.5.4, 3.0.4, 4.0.4 to fix CVE-2025-7783.

Vulnerability

Field Value
ID CVE-2025-7783
Severity CRITICAL
Scanner trivy
Rule CVE-2025-7783
File server/package-lock.json (dependency: form-data)
Assessment Present in dependency tree, not confirmed reachable

Description: form-data: Unsafe random function in form-data

Evidence

Scanner confirmation: trivy rule CVE-2025-7783 flagged this pattern.

Changes

  • server/package.json
  • server/package-lock.json

Behavior Preservation

The change is scoped to 2 files on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.


This change addresses a pattern flagged by static analysis. The code path handles user-influenced input and the fix reduces the attack surface against both manual and automated exploitation.


Automated security fix by OrbisAI Security

Summary by CodeRabbit

  • Chores
    • Updated the form-data package to a newer version for improved compatibility and maintenance.

Automated dependency upgrade by OrbisAI Security
@github-actions github-actions Bot added type:fix Bug fix area:server Node.js server code labels Aug 1, 2026
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The server updates its form-data dependency constraint from ^2.3.3 to ^2.5.4.

Changes

Dependency update

Layer / File(s) Summary
Update form-data version
server/package.json
The form-data dependency constraint changes from ^2.3.3 to ^2.5.4.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: pierre-gilles

Poem

A rabbit hops through the package den,
Updates form-data, then hops again.
From two-three-three to two-five-four,
A tidy version at the door.
“All set!” says Bunny, ears held high.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the form-data security upgrade and the CVE addressed by the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request has been flagged as potential spam (promotional) by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/package.json (1)

93-93: 📐 Maintainability & Code Quality | 🔵 Trivial

Run the required server checks before pushing.

Run npm run prettier, npm run prettier-check, npm run eslint, and npm run coverage from server/.

As per coding guidelines, these checks are required for server changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/package.json` at line 93, Before pushing the server changes, run npm
run prettier, npm run prettier-check, npm run eslint, and npm run coverage from
the server directory, then address any reported failures.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/package.json`:
- Line 93: Update the server dependency lock data so the nested form-data
package resolved under axios is patched to version 4.0.4 or later, while
preserving the existing top-level form-data dependency declaration.

---

Nitpick comments:
In `@server/package.json`:
- Line 93: Before pushing the server changes, run npm run prettier, npm run
prettier-check, npm run eslint, and npm run coverage from the server directory,
then address any reported failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8cd08105-7eb7-42f5-9869-7e70a43d56f7

📥 Commits

Reviewing files that changed from the base of the PR and between 4a10ce3 and b65e5d0.

⛔ Files ignored due to path filters (1)
  • server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • server/package.json

Comment thread server/package.json
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"form-data": "^2.3.3",
"form-data": "^2.5.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

node <<'NODE'
const fs = require("fs");

const lock = JSON.parse(
  fs.readFileSync("server/package-lock.json", "utf8"),
);

const entries = Object.entries(lock.packages ?? {})
  .filter(([path, meta]) =>
    path.endsWith("/node_modules/form-data") && meta?.version
  );

function isVulnerable(version) {
  const [major, minor, patch] = version.split(".").map(Number);

  return (
    (major === 2 && (minor < 5 || (minor === 5 && patch < 4))) ||
    (major === 3 && (minor === 0 && patch < 4)) ||
    (major === 4 && (minor === 0 && patch < 4))
  );
}

if (entries.length === 0) {
  throw new Error("No form-data entries found in server/package-lock.json");
}

const vulnerable = entries.filter(([, meta]) => isVulnerable(meta.version));

for (const [path, meta] of entries) {
  console.log(`${path}: ${meta.version}`);
}

if (vulnerable.length > 0) {
  process.exitCode = 1;
  console.error("Vulnerable form-data versions detected.");
}
NODE

Repository: GladysAssistant/Gladys

Length of output: 249


Patch the remaining form-data dependency.

server/package-lock.json still resolves node_modules/axios/node_modules/form-data to 4.0.0. This is below the patched 4.0.4; update the vulnerable locked version before merge.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/package.json` at line 93, Update the server dependency lock data so
the nested form-data package resolved under axios is patched to version 4.0.4 or
later, while preserving the existing top-level form-data dependency declaration.

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (4a10ce3) to head (b65e5d0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2736   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files        1184     1184           
  Lines       24679    24679           
=======================================
  Hits        24467    24467           
  Misses        212      212           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Pierre-Gilles Pierre-Gilles added the needs:cursor-review Automated review by Cursor is needed label Aug 1, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the CVE-2025-7783 bump — the direct form-data dependency is correctly moved off 2.5.1.

However, this PR does not fully remediate the CVE in server/package-lock.json. axios still nests form-data@4.0.0 (node_modules/axios/node_modules/form-data), which is in the vulnerable 4.0.0–4.0.3 range. That nested copy matters more in practice: Gladys uses axios for HTTP (server/lib/http/http.request.js and several integrations), while the top-level form-data package is not directly require’d in server source.

Please update the lockfile so every resolved form-data under server/ is patched (>=2.5.4 / >=3.0.4 / >=4.0.4). Practical options:

  1. Add an overrides entry forcing nested form-data under axios to ^4.0.4 (front already uses overrides), or
  2. Bump axios to >=1.11.0 (those releases declare form-data: ^4.0.4), then regenerate the lockfile.

Also prefer ^2.5.5 (or newer 2.5.x) for the direct dependency — npm marks 2.5.4 as deprecated (“incorrect dependency; please use v2.5.5”).

Not approving until the nested vulnerable copy is gone. No risk:high / needs:human-review — this is a clear incomplete security dependency fix, not a product/philosophy question. CI is green, but that does not validate the CVE is cleared.

Open in Web View Automation 

Sent by Cursor Automation: Automatic PR review

Comment thread server/package.json
"express": "^4.18.2",
"express-rate-limit": "^6.7.0",
"form-data": "^2.3.3",
"form-data": "^2.5.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Incomplete CVE-2025-7783 fix: bumping the direct dependency to ^2.5.4 only patches node_modules/form-data. The lockfile still resolves node_modules/axios/node_modules/form-data to 4.0.0, which remains vulnerable (4.0.0–4.0.3).

Axios is the path Gladys actually uses for HTTP multipart; the top-level form-data package is not imported in server source. Please also patch that nested copy (npm overrides on axiosform-data, or bump axios to >=1.11.0 which depends on form-data: ^4.0.4) and regenerate server/package-lock.json.

Secondary: prefer ^2.5.5+ here — 2.5.4 is deprecated on npm for an incorrect dependency declaration.

Comment thread server/package-lock.json
"version": "2.5.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.4.tgz",
"integrity": "sha512-Y/3MmRiR8Nd+0CUtrbvcKtKzLWiUfpQ7DFVggH8PwmGt/0r7RSy32GuP4hpCJlQNEBusisSx1DLtD8uD386HJQ==",
"deprecated": "This version has an incorrect dependency; please use v2.5.5",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This lock entry correctly moves off 2.5.1, but npm publishes 2.5.4 as deprecated (please use v2.5.5). Please bump to 2.5.5 or 2.5.6 when regenerating the lockfile, and ensure the nested axios copy is not left at 4.0.0.

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

Labels

area:server Node.js server code needs:cursor-review Automated review by Cursor is needed type:fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants