stream: validate options.signal in iter Writer methods#64411
Open
SAY-5 wants to merge 1 commit into
Open
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Collaborator
|
Review requested:
|
Member
|
The issue https://www.github.com/nodejs/node/issues/64384 is already assigned, and there's an open PR which is linked as well as approved https://www.github.com/nodejs/node/pull/64385 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #64384
The
push(),broadcast()andfromWritable()writers all accept anoptions.signalonwrite(),writev()andend(), but none of themvalidated it. A malformed value (for example a string) was silently
accepted: on the sync fast path a truthy non-signal skipped straight into
the async path and threw later,
end()ignored it entirely, and theclassic writer never looked at it at all. The constructors already run
validateAbortSignal, so the per-write methods were the only place where abad signal slipped through.
This validates
options.signalat the start of each writer method, matchingthe constructor behaviour and throwing
ERR_INVALID_ARG_TYPEconsistently.A valid signal and an absent signal are unaffected. For the classic writer
the signal is still not used for cancellation (that is handled at the
pipeline level), it is only validated.
Added assertions to
test-stream-iter-validation.jscovering all threewriters.