Skip to content

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

Open
fengmk2 wants to merge 2 commits into
4.xfrom
codex/fix-multipart-4x
Open

fengmk2 wants to merge 2 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: c8e6c4fa-7cf2-4c78-9a6b-80676adf92a0

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: e3be5c2

@socket-security

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
combined-stream: 1.0.8
es-set-tostringtag: 2.1.0
hasown: 2.0.2
hasown: 2.0.4

This branch has not been deployed

No deployments
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