Skip to content

Commit 4050419

Browse files
authored
fix(cli): resolve vm2 security vulnerability (#5070)
1 parent ed23150 commit 4050419

File tree

63 files changed

+342
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+342
-214
lines changed

packages/@ionic/cli-framework-prompts/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TERMINAL_INFO } from '@ionic/utils-terminal';
2-
import * as Debug from 'debug';
2+
import { debug as Debug } from 'debug';
33

44
const debug = Debug('ionic:cli-framework-prompts');
55

packages/@ionic/cli-framework/src/lib/__tests__/options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as minimist from 'minimist';
1+
import minimist from 'minimist';
22

33
import { CommandMetadata } from '../../definitions';
44
import { OptionFilters, filterCommandLineOptions, filterCommandLineOptionsByGroup, metadataOptionsToParseArgsOptions, separateArgv, stripOptions, unparseArgs } from '../options';

packages/@ionic/cli-framework/src/lib/colors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ColorFunction, Colors as BaseColors } from '@ionic/cli-framework-output';
2-
import * as chalk from 'chalk';
2+
import chalk from 'chalk';
33
import * as lodash from 'lodash';
44

55
import { MetadataGroup } from '../definitions';

packages/@ionic/cli-framework/src/lib/help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { filter, map } from '@ionic/utils-array';
22
import { generateFillSpaceStringList, stringWidth, wordWrap } from '@ionic/utils-terminal';
3-
import * as Debug from 'debug';
3+
import { debug as Debug } from 'debug';
44
import * as lodash from 'lodash';
55

66
import { CommandMetadata, CommandMetadataInput, CommandMetadataOption, Footnote, HydratedCommandMetadata, HydratedNamespaceMetadata, ICommand, INamespace, LinkFootnote, MetadataGroup, NamespaceLocateResult, NamespaceMetadata } from '../definitions';
@@ -223,7 +223,7 @@ export class NamespaceStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N e
223223

224224
const filteredCommands = await filter(commands, async cmd => this.filterCommandCallback(cmd));
225225

226-
const [ cmdDetails, nsDetails ] = await Promise.all([
226+
const [cmdDetails, nsDetails] = await Promise.all([
227227
this.getListOfCommandDetails(filteredCommands.filter(cmd => cmd.namespace === this.namespace)),
228228
this.getListOfNamespaceDetails(filteredCommands.filter(cmd => cmd.namespace !== this.namespace)),
229229
]);

packages/@ionic/cli-framework/src/lib/options.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as lodash from 'lodash';
2-
import * as minimist from 'minimist';
2+
import minimist from 'minimist';
33

44
import { CommandLineOptions, CommandMetadataOption, HydratedParseArgsOptions, ParsedArg } from '../definitions';
55

@@ -19,7 +19,7 @@ export { ParsedArgs } from 'minimist';
1919
*/
2020
export function stripOptions(pargv: readonly string[], { includeSeparated = true }: { includeSeparated?: boolean; }): string[] {
2121
const r = /^\-/;
22-
const [ ownArgs, otherArgs ] = separateArgv(pargv);
22+
const [ownArgs, otherArgs] = separateArgv(pargv);
2323
const filteredArgs = ownArgs.filter(arg => !r.test(arg));
2424

2525
if (!includeSeparated) {
@@ -50,7 +50,7 @@ export function separateArgv(pargv: readonly string[]): [string[], string[]] {
5050
otherArgs.shift(); // strip separator
5151
}
5252

53-
return [ ownArgs, otherArgs ];
53+
return [ownArgs, otherArgs];
5454
}
5555

5656
/**
@@ -166,8 +166,8 @@ export function filterCommandLineOptions<O extends CommandMetadataOption>(option
166166

167167
const pairs = Object.keys(parsedArgs)
168168
.map((k): [string, O | undefined, ParsedArg | undefined] => [k, mapped.get(k), parsedArgs[k]])
169-
.filter(([ k, opt, value ]) => opt && predicate(opt, value))
170-
.map(([ k, opt, value ]) => [opt ? opt.name : k, value]);
169+
.filter(([k, opt, value]) => opt && predicate(opt, value))
170+
.map(([k, opt, value]) => [opt ? opt.name : k, value]);
171171

172172
return { ...initial, ...lodash.fromPairs(pairs) };
173173
}
@@ -221,7 +221,7 @@ export function unparseArgs(parsedArgs: minimist.ParsedArgs, { useDoubleQuotes,
221221
const dashKey = (k: string) => (k.length === 1 ? '-' : '--') + k;
222222

223223
const pushPairs = (...pairs: [string, string | undefined][]) => {
224-
for (const [ k, val ] of pairs) {
224+
for (const [k, val] of pairs) {
225225
const key = dashKey(allowCamelCase ? k : k.replace(/[A-Z]/g, '-$&').toLowerCase());
226226

227227
if (useEquals) {
@@ -274,7 +274,7 @@ export function unparseArgs(parsedArgs: minimist.ParsedArgs, { useDoubleQuotes,
274274
isKnown(k)
275275
);
276276

277-
for (const [ key, val ] of pairedOptions) {
277+
for (const [key, val] of pairedOptions) {
278278
if (val === true) {
279279
pushPairs([key, undefined]);
280280
} else if (val === false && !ignoreFalse) {

packages/@ionic/cli-framework/src/lib/validators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as chalk from 'chalk';
1+
import chalk from 'chalk';
22

33
import { ValidationError, Validator, Validators } from '../definitions';
44
import { InputValidationError } from '../errors';

packages/@ionic/cli-framework/src/utils/ipc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fork } from '@ionic/utils-subprocess';
22
import { ChildProcess } from 'child_process';
3-
import * as Debug from 'debug';
3+
import { debug as Debug } from 'debug';
44
import * as fs from 'fs';
55

66
import { ERROR_IPC_UNKNOWN_PROCEDURE, IPCError } from '../errors';

packages/@ionic/cli/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
!jest.config.js
44
!lint-staged.config.js
55
*.d.ts
6+
*.tgz

packages/@ionic/cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"ssh-config": "^1.1.1",
6464
"stream-combiner2": "^1.1.1",
6565
"superagent": "^8.0.9",
66-
"superagent-proxy": "^3.0.0",
66+
"proxy-agent": "^6.3.0",
6767
"tar": "^6.0.1",
6868
"tslib": "^2.0.1"
6969
},
@@ -77,7 +77,6 @@
7777
"@types/semver": "^7.1.0",
7878
"@types/split2": "^2.1.6",
7979
"@types/superagent": "4.1.3",
80-
"@types/superagent-proxy": "^3.0.0",
8180
"@types/tar": "^6.1.2",
8281
"jest": "^26.4.2",
8382
"jest-cli": "^26.0.1",

packages/@ionic/cli/src/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { compileNodeModulesPaths, readPackageJsonFile } from '@ionic/cli-framework/utils/node';
2-
import * as Debug from 'debug';
2+
import { debug as Debug } from 'debug';
33
import * as path from 'path';
44
import * as semver from 'semver';
55

0 commit comments

Comments
 (0)