Skip to content

fix(ext/node): fix send() validation in child_process IPC#32779

Merged
bartlomieju merged 3 commits intodenoland:mainfrom
fraidev:fix/child-process-send-validation
Mar 17, 2026
Merged

fix(ext/node): fix send() validation in child_process IPC#32779
bartlomieju merged 3 commits intodenoland:mainfrom
fraidev:fix/child-process-send-validation

Conversation

@fraidev
Copy link
Copy Markdown
Contributor

@fraidev fraidev commented Mar 16, 2026

Two validation issues in the IPC send() function:

  1. Used new TypeError("ERR_MISSING_ARGS") instead of the proper ERR_MISSING_ARGS error class, so the error had the code as its message instead of the correct message and code properties.

  2. Missing type validation for the message argument. Sending a Symbol would hit the IPC serializer and throw an internal error instead of the expected ERR_INVALID_ARG_TYPE. Now validates that message is string, object, number, or boolean before attempting to send.

Two validation issues in the IPC send() function:

1. Used `new TypeError("ERR_MISSING_ARGS")` instead of the proper
   `ERR_MISSING_ARGS` error class, so the error had the code as its
   message instead of the correct message and code properties.

2. Missing type validation for the message argument. Sending a Symbol
   would hit the IPC serializer and throw an internal error instead of
   the expected ERR_INVALID_ARG_TYPE. Now validates that message is
   string, object, number, or boolean before attempting to send.
) {
throw new ERR_INVALID_ARG_TYPE(
"message",
["string", "object", "number", "boolean"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also apply to advanced serialization? I was under the impression advanced serialization works on every type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this validation applies to both modes in Node.js. Even with advanced serialization, Node.js rejects Symbol at the send() level before it reaches the serializer. V8's ValueSerializer also can't serialize Symbols. So the PR's approach is correct for both modes — but the bigint handling needs clarification since advanced serialization can handle BigInt (via BigInt64Array etc.) while JSON serialization cannot.

Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju enabled auto-merge (squash) March 17, 2026 11:59
@bartlomieju bartlomieju merged commit 2309415 into denoland:main Mar 17, 2026
220 of 222 checks passed
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.

3 participants