mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 21:11:38 +01:00
Fix a bypass for CVE-2020-16881
Fixes #107951 Uses child_process.execFile() rather than child_process.exec() to more effectively resolve the command injection vulnerability.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user