Skip to content

Commit

Permalink
Fix a bypass for CVE-2020-16881 (#108034)
Browse files Browse the repository at this point in the history
Fixes #107951

Uses child_process.execFile() rather than child_process.exec() to more
effectively resolve the command injection vulnerability.

Co-authored-by: Justin Steven <[email protected]>
  • Loading branch information
aeschli and justinsteven authored Oct 3, 2020
1 parent 0ecb64a commit 48ca6d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/npm/src/features/packageJSONContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ export class PackageJSONContribution implements IJSONContribution {

private npmView(pack: string): Promise<ViewPackageInfo | undefined> {
return new Promise((resolve, _reject) => {
const command = 'npm view --json ' + pack + ' description dist-tags.latest homepage version';
cp.exec(command, (error, stdout) => {
const args = ['view', '--json', pack, 'description', 'dist-tags.latest', 'homepage', 'version'];
cp.execFile('npm', args, (error, stdout) => {
if (!error) {
try {
const content = JSON.parse(stdout);
Expand Down

0 comments on commit 48ca6d9

Please sign in to comment.