-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Feature/upgrade runtime #3347
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
Open
saecula
wants to merge
6
commits into
develop
Choose a base branch
from
feature/upgrade-runtime-with-http2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+417
−160
Open
Feature/upgrade runtime #3347
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f048ad5
fix output-check tests
saecula 1b1cfda
upgrade postman-runtime, re-add http/2 support + int tests
saecula 5ed273b
fix security check, ignore claude dir
saecula e250918
rm overrides
saecula 95be716
revert http/2 support
saecula bc01134
rm http/2 test
saecula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium test
Copilot Autofix
AI about 1 month ago
In general, the problem is that
shelljs.execis called with a single stringcmdthat was built by interpolating a path. The shell then parsescmd, so spaces or metacharacters in the path can alter the command. The standard fix is to avoid the shell for argument parsing: either (a) change callers to pass arguments separately and use an API that does not invoke a shell, or (b) at least escape or quote the interpolated values. Since we cannot touch the callers other than the shown test file, the best approach here is to (1) refactor the tests to usechild_process.spawn/execFiledirectly with an argument array instead ofglobal.exec, and (2) makeglobal.execinnpm/test-cli.jsreject multi-word shell commands and only allow a single binary path, effectively preventing unsafe templates from being used.Concretely:
In
test/cli/working-directory.test.js, stop callingglobal.execwith a template literal. Instead, require Node’schild_processand usespawn(orexecFile) with:'node'['./bin/newman.js', 'run', 'test/fixtures/run/single-file-....json', '--working-dir', workingDir, ...]This passes
workingDiras a separate argument and bypasses shell parsing entirely.In
npm/test-cli.js, harden the overriddenglobal.execso it only accepts a command that is a simple binary path with no spaces (or is already an array), and throws if the caller passes something that looks like a shell command line. This addresses the CodeQL sink at line 35 by ensuring we never pass an arbitrary space-containing string toshelljs.exec. For compatibility with existing tests that legitimately use a string binary path, we allow a single word (no whitespace) or, optionally, an object/array form; for now we’ll implement the strict single-token check. This keeps existing functionality for legitimate usages while blocking unsafe patterns like those inworking-directory.test.jswhich we are refactoring away.No new external packages are needed:
child_processis built-in. The required changes are limited to the shown snippets innpm/test-cli.jsandtest/cli/working-directory.test.js.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was already here, but added check for allowed prefixes to make it theoretically happier