Skip to content

Align behavior of inheriting shell with Node.js' child_process API#2447

Merged
ericcornelissen merged 8 commits intomainfrom
test-assumptions
Apr 5, 2026
Merged

Align behavior of inheriting shell with Node.js' child_process API#2447
ericcornelissen merged 8 commits intomainfrom
test-assumptions

Conversation

@ericcornelissen
Copy link
Copy Markdown
Owner

@ericcornelissen ericcornelissen commented Mar 29, 2026

Summary

Create a new (compatibility) test suite that tests the assumptions this library makes about the runtime. Because the behavior of the runtime can change over time this is classified and ran as a compatibility test. We assume that the runtime doesn't change its behavior with respect to these assumption within a major version. This test suite does NOT have test coverage because, put simply, we shouldn't be running this libraries code in this suite.

Create a new (compatibility) test suite that tests the assumptions this
library makes about the runtime. Because the behavior of the runtime can
change over time this is classified and ran as a compatibility test. We
assume that the runtime doesn't change its behavior with respect to
these assumption within a major version. This test suite does NOT have
test coverage because, put simply, we shouldn't be running this
libraries code in this suite.

The only test in the suite so far tests if the runtime inherits the
`shell` option from the prototype. The motivation for testing this is
that the library currently assumes it does not (see
`src/internal/options.js` line 52) but this test demonstrates that for
older Node.js version the runtime does actually use the prototype's
value, indicating a bug in the library (namely: this _could_ lead to
`node:child_process` and Shescape disagreeing about the shell being used
which may enable bypassing escaping).
@ericcornelissen ericcornelissen added the test Relates to testing label Mar 29, 2026
@github-actions github-actions bot added the ci/cd Relates to ci/cd label Mar 29, 2026
Aligning with the behavior of the `child_process` API in older versions,
as per the assumptions test suite.
- Document `npm run test:compat:assumptions`.
- Add `npm run test:compat:regexp:all` to align with other
  `test:compat:*` targets as well as the fact that in CI `npm run
  test:compat:regexp` is run for (almost) all Node.js versions.
Clarify explicitly that polluted prototypes (i.e., untrusted "Node
environments") are considered out of scope through the threat model.
"test:compat:assumptions:all": "nve 14.18.0,16.13.0,18.0.0,19.0.0,20.0.0,22.0.0,24.0.0,25.0.0 npm run test:compat:assumptions",
"test:compat:runtime": "node test/compat/runtime/runner.js",
"test:compat:runtime:all": "nve 14.18.0,16.13.0,18.0.0,19.0.0,20.0.0,22.0.0 npm run test:compat",
"test:compat:runtime:all": "nve 14.18.0,16.13.0,18.0.0,19.0.0,20.0.0,22.0.0,24.0.0,25.0.0 npm run test:compat:runtime",
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Relates to #1968, #2342

Because it is not compatible with all supported Node.js versions.
@github-actions github-actions bot added the meta Relates to the project or repository itself label Mar 29, 2026
@ericcornelissen ericcornelissen added the bug Something isn't working label Mar 29, 2026
@ericcornelissen ericcornelissen changed the title Create an "assumptions" test suite Align behavior of inheriting shell with Node.js' child_process API Mar 29, 2026
@ericcornelissen ericcornelissen marked this pull request as ready for review March 29, 2026 21:03
@ericcornelissen

This comment was marked as resolved.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ericcornelissen

This comment was marked as resolved.

@coderabbitai

This comment was marked as spam.

@coderabbitai

This comment was marked as spam.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ead056a-4c5f-461b-aa1f-48d2f1cffcb4

📥 Commits

Reviewing files that changed from the base of the PR and between 7553744 and 83d5e84.

📒 Files selected for processing (12)
  • .github/workflows/checks.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • SECURITY.md
  • config/eslint.js
  • package.json
  • src/index.js
  • src/internal/options.js
  • test/_arbitraries.js
  • test/compat/assumptions/child-process.test.js
  • test/compat/assumptions/runner.js
  • test/unit/options/parse-options.test.js

@ericcornelissen ericcornelissen merged commit 818e4ac into main Apr 5, 2026
39 checks passed
@ericcornelissen ericcornelissen deleted the test-assumptions branch April 5, 2026 16:23
@ericcornelissen ericcornelissen removed the meta Relates to the project or repository itself label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci/cd Relates to ci/cd test Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant