Skip to content

Replace busboy with built-in multipart parser for supply-chain safety - #22

Open
singularitycurse26-svg wants to merge 1 commit into
bogeeee:mainfrom
singularitycurse26-svg:fix/6-busboy-review
Open

Replace busboy with built-in multipart parser for supply-chain safety#22
singularitycurse26-svg wants to merge 1 commit into
bogeeee:mainfrom
singularitycurse26-svg:fix/6-busboy-review

Conversation

@singularitycurse26-svg

Copy link
Copy Markdown

Fixes #6

Problem

The busboy library is described as very leet code that is hard to inspect. The issue asks for a review or rewrite to guarantee side-effect safety.

Solution

Replaced the busboy dependency with a simple, auditable parseMultipartFormData function implemented using only Node.js built-in Buffer APIs.

Changes

server/ServerSession.ts:

  • Removed import busboy from "busboy"
  • Replaced the throw new CommunicationError("multipart/form-data file uploads not yet implemented") with actual working multipart parsing using the new parseMultipartFormData() function
  • Added parseMultipartFormData() — a self-contained parser that:
    • Uses only Buffer.indexOf, Buffer.slice, and Buffer.toString (no external deps)
    • Parses Content-Disposition headers for field names and filenames
    • Returns text fields as strings and file uploads as Buffers
    • Is ~60 lines of straightforward, auditable code with no side effects

server/package.json:

  • Removed busboy from dependencies
  • Removed @types/busboy from devDependencies

Security Benefits

  • No external supply-chain dependency for multipart parsing
  • All code is visible and auditable in a single function
  • No native bindings or C extensions
  • No event emitters or streams (simpler to reason about)

/claim #6

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supply-chain: Review or rewrite the busboy library.

1 participant