Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

child_process: validate arguments for null bytes #44782

Conversation

RaisinTen
Copy link
Member

@RaisinTen RaisinTen commented Sep 25, 2022

This change adds validation to reject an edge case where the child_process API argument strings might contain null bytes somewhere in between. Such strings were being silently truncated before, so throwing an error should prevent misuses of this API.

Fixes: #44768
Signed-off-by: Darshan Sen raisinten@gmail.com

@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run. labels Sep 25, 2022
@nodejs-github-bot

This comment was marked as outdated.

@RaisinTen RaisinTen force-pushed the child_process/validate-arguments-for-null-bytes branch from c74b77f to 67903b0 Compare Sep 25, 2022
@nodejs-github-bot

This comment was marked as outdated.

lib/child_process.js Outdated Show resolved Hide resolved
lib/child_process.js Outdated Show resolved Hide resolved
This change adds validation to reject an edge case where the
child_process API argument strings might contain null bytes
somewhere in between. Such strings were being silently truncated
before, so throwing an error should prevent misuses of this API.

Fixes: nodejs#44768
Signed-off-by: Darshan Sen <raisinten@gmail.com>
@RaisinTen RaisinTen force-pushed the child_process/validate-arguments-for-null-bytes branch from 67903b0 to a6bb1c4 Compare Oct 3, 2022
@RaisinTen RaisinTen added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 3, 2022
@nodejs-github-bot

This comment was marked as outdated.

@RaisinTen
Copy link
Member Author

RaisinTen commented Oct 6, 2022

cc @nodejs/child_process in case anyone else also wants to take a look.

Copy link
Member

@ZYSzys ZYSzys left a comment

Should this be semver-major ?

@RaisinTen
Copy link
Member Author

RaisinTen commented Oct 7, 2022

@ZYSzys I would say no because code that previously tried to pass string arguments with null bytes was already broken because the strings were silently getting truncated at the first null byte. This validation would make it easier for users to know where things went wrong.

@RaisinTen RaisinTen added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed review wanted PRs that need reviews. labels Oct 11, 2022
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Contributor

nodejs-github-bot commented Oct 12, 2022

@RaisinTen
Copy link
Member Author

RaisinTen commented Oct 12, 2022

@bnoordhuis @ZYSzys would y'all like to take another look?

@RaisinTen RaisinTen added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 14, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 14, 2022
@nodejs-github-bot nodejs-github-bot merged commit 91dbd8b into nodejs:main Oct 14, 2022
54 checks passed
@nodejs-github-bot
Copy link
Contributor

nodejs-github-bot commented Oct 14, 2022

Landed in 91dbd8b

@RaisinTen RaisinTen deleted the child_process/validate-arguments-for-null-bytes branch Oct 14, 2022
RafaelGSS pushed a commit that referenced this pull request Nov 1, 2022
This change adds validation to reject an edge case where the
child_process API argument strings might contain null bytes
somewhere in between. Such strings were being silently truncated
before, so throwing an error should prevent misuses of this API.

Fixes: #44768
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44782
Reviewed-By: James M Snell <jasnell@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Nov 1, 2022
RafaelGSS pushed a commit that referenced this pull request Nov 10, 2022
This change adds validation to reject an edge case where the
child_process API argument strings might contain null bytes
somewhere in between. Such strings were being silently truncated
before, so throwing an error should prevent misuses of this API.

Fixes: #44768
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44782
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

child_process.spawn not checking null byte in args
5 participants