Skip to content

fix(4.x): escape multipart filenames and field names - #985

Merged
fengmk2 merged 7 commits into
4.xfrom
codex/fix-multipart-4x
Nov 17, 2026
Merged

fengmk2 merged 7 commits into
4.xfrom
codex/fix-multipart-4x

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 17, 2026

Copy link
Copy Markdown
Member

Multipart uploads insert filenames into Content-Disposition without escaping CR, LF, or double quotes. These characters can inject additional part headers.

Encode CR, LF, and double quotes as %0D, %0A, and %22. Require form-data@^4.0.6 for safe field names and formstream@^1.5.3 for safe metadata in legacy stream bodies. MIME types containing CR or LF cause a synchronous TypeError in formstream.

Preserve the existing filename* behavior for non-ASCII filenames.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 05:10
@agentscanapp

agentscanapp Bot commented Nov 17, 2026

Copy link
Copy Markdown

Automation signals

Activity patterns show signs of automation.

View full analysis →

Report this account →

Evidence
  • PRs to many projects in one day: Opened PRs in 69 different repos within 24 hours
  • Very high PR volume (daily): 72 PRs within a single 24-hour window, 39 of them to repos it can push to
  • High PR volume (weekly): 72 PRs within a single 7-day window, 39 of them to repos it can push to

Last 5 PRs:

This is an automated analysis by AgentScan

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a658d7e8-0da0-4d4a-9d65-06a1e834fd7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/node-modules/urllib@985

commit: 8d33072

@socket-security

socket-security Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedform-data@​4.0.5 ⏵ 4.0.699 +1100 +16100 +187100
Updatedformstream@​1.5.2 ⏵ 1.5.3100 +1100100 +188 +7100

View full report

Copilot AI 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.

🟡 Changes recommended

The lockfile retains deduplicable hasown versions, causing the CI vp dedupe --check gate to fail.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

This PR hardens urllib’s multipart uploads against header injection while preserving existing non-ASCII filename* behavior.

Changes:

  • Escape carriage returns, line feeds, and double quotes in multipart filenames.
  • Upgrade form-data and formstream for safer field names and legacy multipart metadata.
  • Add regression tests for filename injection, field-name escaping, and filename compatibility.
File Description
test/​options.files.test.ts Tests injection prevention across upload sources and field names.
test/​formData.test.ts Tests filename escaping, Unicode compatibility, and custom filepaths.
src/​FormData.ts Escapes filenames and updates the own-property check.
pnpm-lock.yaml Locks updated multipart dependencies and transitive resolutions.
package.json Raises minimum multipart dependency versions.

Review effort: Balanced

Comment thread pnpm-lock.yaml Resolved
Copilot AI balanced review requested due to automatic review settings November 17, 2026 07:29
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (4.x@6e58d98). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff           @@
##             4.x     #985   +/-   ##
======================================
  Coverage       ?   92.86%           
======================================
  Files          ?       10           
  Lines          ?      757           
  Branches       ?      236           
======================================
  Hits           ?      703           
  Misses         ?       51           
  Partials       ?        3           

☔ 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.

Copilot AI 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.

🔵 Needs a closer look

The lockfile contains redundant hasown resolutions at 2.0.4 and 2.0.2 that will fail CI’s deduplication check and must be consolidated.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 17, 2026 07:35

Copilot AI 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.

🟢 Approval recommended

No active review issues block the multipart upload header-injection hardening changes.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 17, 2026 07:38

Copilot AI 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.

🟢 Approval recommended

No active review issues are identified for the multipart upload hardening changes.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 17, 2026 07:41

Copilot AI 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.

🟢 Approval recommended

No active review issues remain for the multipart upload hardening changes.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 17, 2026 07:43

Copilot AI 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.

🟢 Approval recommended

No active review issues block the multipart upload hardening changes.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

@fengmk2
fengmk2 merged commit 32bee38 into 4.x Nov 17, 2026
24 checks passed
@fengmk2
fengmk2 deleted the codex/fix-multipart-4x branch November 17, 2026 08:59
@fengmk2 fengmk2 mentioned this pull request Nov 17, 2026
fengmk2 added a commit that referenced this pull request Nov 17, 2026
Set the version to `4.9.2` and update `CHANGELOG.md` for the multipart
header injection fix and compatibility changes in #985.

After merge and manual approval, the release workflow publishes to npm
under `latest-4` and creates the GitHub release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants