Skip to content

fix(3.x): require formstream with safe multipart headers - #986

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

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

Conversation

@fengmk2

@fengmk2 fengmk2 commented Nov 17, 2026

Copy link
Copy Markdown
Member

The 3.x branch uses Undici or form-data-encoder for multipart uploads, but it also accepts legacy formstream bodies.

Require formstream@^1.5.3 to encode CR, LF, and double quotes in field names and filenames. MIME types containing CR or LF cause a synchronous TypeError. Preserve the existing escaping behavior in both built-in encoders.

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: d1131b9d-36fc-4857-bc53-da6b41d6432c

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

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 new tests cover built-in encoders rather than the affected legacy FormStream path, leaving escaping and synchronous rejection of CR/LF-containing MIME types without regression coverage.

1 open issue
What changed in this PR

This PR raises the 3.x branch’s minimum formstream version to secure legacy multipart headers while adding regression coverage for the existing built-in encoders.

Changes:

  • Require formstream@^1.5.3 for header escaping and rejection of MIME types containing CR or LF.
  • Test filename and field-name escaping, unchanged field values, and Unicode filenames with both built-in encoders.
  • Update the legacy upload test’s expected boundary format.
File Description
test/​options.stream.test.ts Update the expected multipart boundary to 24 hexadecimal characters.
test/​multipart-escaping.test.ts Add escaping regression tests for Undici and the Node 14 fallback encoder.
package.json Raise the minimum formstream version to 1.5.3.

Review effort: Balanced

import { describe, it, beforeAll, afterAll, vi } from 'vitest';
import { startServer } from './fixtures/server';

describe.each([ 'Undici', 'Node 14 fallback' ])('multipart escaping with %s', encoder => {

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