未验证 提交 48ca6d9f 编写于 作者: M Martin Aeschlimann 提交者: GitHub

Fix a bypass for CVE-2020-16881 (#108034)

Fixes #107951

Uses child_process.execFile() rather than child_process.exec() to more
effectively resolve the command injection vulnerability.
Co-authored-by: NJustin Steven <justin@justinsteven.com>
上级 0ecb64a2
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册