Repository navigation
fix(4.x): escape multipart filenames and field names - #985
Conversation
Automation signalsActivity patterns show signs of automation. Evidence
Last 5 PRs:
This is an automated analysis by AgentScan |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
commit: |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
🟡 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-dataandformstreamfor 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
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.

Multipart uploads insert filenames into
Content-Dispositionwithout escaping CR, LF, or double quotes. These characters can inject additional part headers.Encode CR, LF, and double quotes as
%0D,%0A, and%22. Requireform-data@^4.0.6for safe field names andformstream@^1.5.3for safe metadata in legacy stream bodies. MIME types containing CR or LF cause a synchronousTypeErrorinformstream.Preserve the existing
filename*behavior for non-ASCII filenames.