@socketsecurity/cli-with-sentry 0.15.30 → 0.15.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +134 -65
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/package.json +1 -1
- package/dist/vendor.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -3641,6 +3641,23 @@ const cmdDiffScan = {
|
|
|
3641
3641
|
}
|
|
3642
3642
|
};
|
|
3643
3643
|
|
|
3644
|
+
async function outputFixResult(result, outputKind) {
|
|
3645
|
+
if (!result.ok) {
|
|
3646
|
+
process.exitCode = result.code ?? 1;
|
|
3647
|
+
}
|
|
3648
|
+
if (outputKind === 'json') {
|
|
3649
|
+
logger.logger.log(utils.serializeResultJson(result));
|
|
3650
|
+
return;
|
|
3651
|
+
}
|
|
3652
|
+
if (!result.ok) {
|
|
3653
|
+
logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
|
|
3654
|
+
return;
|
|
3655
|
+
}
|
|
3656
|
+
logger.logger.log('');
|
|
3657
|
+
logger.logger.success('Finished!');
|
|
3658
|
+
logger.logger.log('');
|
|
3659
|
+
}
|
|
3660
|
+
|
|
3644
3661
|
function formatBranchName(name) {
|
|
3645
3662
|
return name.replace(/[-_.\\/]+/g, '-').replace(/[^-a-zA-Z0-9]+/g, '').replace(/^-+|-+$/g, '');
|
|
3646
3663
|
}
|
|
@@ -4164,37 +4181,8 @@ function getAlertsMapOptions(options = {}) {
|
|
|
4164
4181
|
}
|
|
4165
4182
|
};
|
|
4166
4183
|
}
|
|
4167
|
-
function normalizeFixOptions(options_) {
|
|
4168
|
-
const options = {
|
|
4169
|
-
__proto__: null,
|
|
4170
|
-
...options_
|
|
4171
|
-
};
|
|
4172
|
-
if (typeof options.autopilot !== 'boolean') {
|
|
4173
|
-
options.autopilot = false;
|
|
4174
|
-
}
|
|
4175
|
-
if (typeof options.autoMerge !== 'boolean') {
|
|
4176
|
-
options.autoMerge = !!options.autopilot;
|
|
4177
|
-
}
|
|
4178
|
-
if (typeof options.cwd !== 'string') {
|
|
4179
|
-
options.cwd = process.cwd();
|
|
4180
|
-
}
|
|
4181
|
-
const limit = typeof options.limit === 'number' ? options.limit : parseInt(`${options.limit || ''}`, 10);
|
|
4182
|
-
options.limit = Number.isNaN(limit) ? Infinity : limit;
|
|
4183
|
-
options.purls = Array.isArray(options.purls) ? options.purls.flatMap(p => p.split(/, */)) : [];
|
|
4184
|
-
if (typeof options.rangeStyle !== 'string') {
|
|
4185
|
-
options.rangeStyle = 'preserve';
|
|
4186
|
-
}
|
|
4187
|
-
if (typeof options.test !== 'boolean') {
|
|
4188
|
-
options.test = !!options.autopilot || !!options.testScript;
|
|
4189
|
-
}
|
|
4190
|
-
if (typeof options.testScript !== 'string') {
|
|
4191
|
-
options.testScript = 'test';
|
|
4192
|
-
}
|
|
4193
|
-
return options;
|
|
4194
|
-
}
|
|
4195
4184
|
|
|
4196
4185
|
const {
|
|
4197
|
-
DRY_RUN_NOT_SAVING: DRY_RUN_NOT_SAVING$1,
|
|
4198
4186
|
NPM: NPM$a
|
|
4199
4187
|
} = constants;
|
|
4200
4188
|
async function install$1(arb, options) {
|
|
@@ -4218,17 +4206,12 @@ async function install$1(arb, options) {
|
|
|
4218
4206
|
async function npmFix(pkgEnvDetails, {
|
|
4219
4207
|
autoMerge,
|
|
4220
4208
|
cwd,
|
|
4221
|
-
dryRun,
|
|
4222
4209
|
limit,
|
|
4223
4210
|
purls,
|
|
4224
4211
|
rangeStyle,
|
|
4225
4212
|
test,
|
|
4226
4213
|
testScript
|
|
4227
4214
|
}) {
|
|
4228
|
-
if (dryRun) {
|
|
4229
|
-
logger.logger.log(DRY_RUN_NOT_SAVING$1);
|
|
4230
|
-
return;
|
|
4231
|
-
}
|
|
4232
4215
|
// Lazily access constants.spinner.
|
|
4233
4216
|
const {
|
|
4234
4217
|
spinner
|
|
@@ -4576,7 +4559,6 @@ async function npmFix(pkgEnvDetails, {
|
|
|
4576
4559
|
}
|
|
4577
4560
|
|
|
4578
4561
|
const {
|
|
4579
|
-
DRY_RUN_NOT_SAVING,
|
|
4580
4562
|
NPM: NPM$9,
|
|
4581
4563
|
OVERRIDES: OVERRIDES$2,
|
|
4582
4564
|
PNPM: PNPM$7
|
|
@@ -4620,17 +4602,12 @@ async function install(pkgEnvDetails, options) {
|
|
|
4620
4602
|
async function pnpmFix(pkgEnvDetails, {
|
|
4621
4603
|
autoMerge,
|
|
4622
4604
|
cwd,
|
|
4623
|
-
dryRun,
|
|
4624
4605
|
limit,
|
|
4625
4606
|
purls,
|
|
4626
4607
|
rangeStyle,
|
|
4627
4608
|
test,
|
|
4628
4609
|
testScript
|
|
4629
4610
|
}) {
|
|
4630
|
-
if (dryRun) {
|
|
4631
|
-
logger.logger.log(DRY_RUN_NOT_SAVING);
|
|
4632
|
-
return;
|
|
4633
|
-
}
|
|
4634
4611
|
// Lazily access constants.spinner.
|
|
4635
4612
|
const {
|
|
4636
4613
|
spinner
|
|
@@ -5100,28 +5077,91 @@ const {
|
|
|
5100
5077
|
NPM: NPM$8,
|
|
5101
5078
|
PNPM: PNPM$6
|
|
5102
5079
|
} = constants;
|
|
5103
|
-
async function runFix(
|
|
5104
|
-
|
|
5105
|
-
|
|
5080
|
+
async function runFix({
|
|
5081
|
+
autoMerge,
|
|
5082
|
+
cwd,
|
|
5083
|
+
limit,
|
|
5084
|
+
purls,
|
|
5085
|
+
rangeStyle,
|
|
5086
|
+
test,
|
|
5087
|
+
testScript
|
|
5088
|
+
}) {
|
|
5089
|
+
// TODO: make detectAndValidatePackageEnvironment return a CResult<pkgEnvDetails> and propagate it
|
|
5090
|
+
const pkgEnvDetails = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
5106
5091
|
cmdName: CMD_NAME$1,
|
|
5107
5092
|
logger: logger.logger
|
|
5108
5093
|
});
|
|
5109
5094
|
if (!pkgEnvDetails) {
|
|
5110
|
-
return
|
|
5095
|
+
return {
|
|
5096
|
+
ok: false,
|
|
5097
|
+
message: 'No package found',
|
|
5098
|
+
cause: `No valid package environment was found in given cwd (${cwd})`
|
|
5099
|
+
};
|
|
5111
5100
|
}
|
|
5112
5101
|
logger.logger.info(`Fixing packages for ${pkgEnvDetails.agent}.\n`);
|
|
5113
5102
|
const {
|
|
5114
5103
|
agent
|
|
5115
5104
|
} = pkgEnvDetails;
|
|
5116
5105
|
if (agent === NPM$8) {
|
|
5117
|
-
|
|
5106
|
+
// TODO: make npmFix return a CResult and propagate it
|
|
5107
|
+
await npmFix(pkgEnvDetails, {
|
|
5108
|
+
autoMerge,
|
|
5109
|
+
cwd,
|
|
5110
|
+
limit,
|
|
5111
|
+
purls,
|
|
5112
|
+
rangeStyle,
|
|
5113
|
+
test,
|
|
5114
|
+
testScript
|
|
5115
|
+
});
|
|
5118
5116
|
} else if (agent === PNPM$6) {
|
|
5119
|
-
|
|
5117
|
+
// TODO: make pnpmFix return a CResult and propagate it
|
|
5118
|
+
await pnpmFix(pkgEnvDetails, {
|
|
5119
|
+
autoMerge,
|
|
5120
|
+
cwd,
|
|
5121
|
+
limit,
|
|
5122
|
+
purls,
|
|
5123
|
+
rangeStyle,
|
|
5124
|
+
test,
|
|
5125
|
+
testScript
|
|
5126
|
+
});
|
|
5120
5127
|
} else {
|
|
5121
|
-
|
|
5128
|
+
return {
|
|
5129
|
+
ok: false,
|
|
5130
|
+
message: 'Not supported',
|
|
5131
|
+
cause: `${agent} is not supported by this command at the moment.`
|
|
5132
|
+
};
|
|
5122
5133
|
}
|
|
5134
|
+
return {
|
|
5135
|
+
ok: true,
|
|
5136
|
+
data: undefined
|
|
5137
|
+
};
|
|
5123
5138
|
}
|
|
5124
5139
|
|
|
5140
|
+
async function handleFix({
|
|
5141
|
+
autoMerge,
|
|
5142
|
+
cwd,
|
|
5143
|
+
limit,
|
|
5144
|
+
outputKind,
|
|
5145
|
+
purls,
|
|
5146
|
+
rangeStyle,
|
|
5147
|
+
test,
|
|
5148
|
+
testScript
|
|
5149
|
+
}) {
|
|
5150
|
+
const result = await runFix({
|
|
5151
|
+
autoMerge,
|
|
5152
|
+
cwd,
|
|
5153
|
+
limit,
|
|
5154
|
+
purls,
|
|
5155
|
+
rangeStyle,
|
|
5156
|
+
test,
|
|
5157
|
+
testScript
|
|
5158
|
+
});
|
|
5159
|
+
await outputFixResult(result, outputKind);
|
|
5160
|
+
}
|
|
5161
|
+
|
|
5162
|
+
const {
|
|
5163
|
+
DRY_RUN_NOT_SAVING
|
|
5164
|
+
} = constants;
|
|
5125
5165
|
const config$F = {
|
|
5126
5166
|
commandName: 'fix',
|
|
5127
5167
|
description: 'Update dependencies with "fixable" Socket alerts',
|
|
@@ -5200,11 +5240,25 @@ async function run$F(argv, importMeta, {
|
|
|
5200
5240
|
parentName
|
|
5201
5241
|
});
|
|
5202
5242
|
const {
|
|
5243
|
+
autopilot,
|
|
5203
5244
|
json,
|
|
5204
5245
|
markdown
|
|
5205
5246
|
} = cli.flags;
|
|
5206
|
-
|
|
5207
|
-
|
|
5247
|
+
let {
|
|
5248
|
+
autoMerge,
|
|
5249
|
+
rangeStyle,
|
|
5250
|
+
test
|
|
5251
|
+
} = cli.flags;
|
|
5252
|
+
// TODO: impl json/md further
|
|
5253
|
+
const outputKind = utils.getOutputKind(json, markdown);
|
|
5254
|
+
let [cwd = '.'] = cli.input;
|
|
5255
|
+
// Note: path.resolve vs .join:
|
|
5256
|
+
// If given path is absolute then cwd should not affect it.
|
|
5257
|
+
cwd = path.resolve(process.cwd(), cwd);
|
|
5258
|
+
if (autopilot) {
|
|
5259
|
+
autoMerge = true;
|
|
5260
|
+
test = true;
|
|
5261
|
+
}
|
|
5208
5262
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
5209
5263
|
test: utils.RangeStyles.includes(cli.flags['rangeStyle']),
|
|
5210
5264
|
message: `Expecting range style of ${arrays.joinOr(utils.RangeStyles)}`,
|
|
@@ -5214,15 +5268,24 @@ async function run$F(argv, importMeta, {
|
|
|
5214
5268
|
if (!wasValidInput) {
|
|
5215
5269
|
return;
|
|
5216
5270
|
}
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5271
|
+
if (cli.flags['dryRun']) {
|
|
5272
|
+
logger.logger.log(DRY_RUN_NOT_SAVING);
|
|
5273
|
+
return;
|
|
5274
|
+
}
|
|
5275
|
+
let purls = Array.isArray(cli.flags['purl']) ? cli.flags['purl'] : [];
|
|
5276
|
+
purls = purls.flatMap(p => p.split(/, */));
|
|
5277
|
+
if (!['caret', 'gt', 'gte', 'lt', 'lte', 'pin', 'preserve', 'tilde'].includes(rangeStyle)) {
|
|
5278
|
+
rangeStyle = 'preserve';
|
|
5279
|
+
}
|
|
5280
|
+
await handleFix({
|
|
5281
|
+
autoMerge: Boolean(autoMerge),
|
|
5282
|
+
cwd,
|
|
5283
|
+
limit: (cli.flags['limit'] ? parseInt(String(cli.flags['limit'] || ''), 10) : Infinity) || Infinity,
|
|
5284
|
+
outputKind,
|
|
5285
|
+
purls,
|
|
5286
|
+
rangeStyle: rangeStyle,
|
|
5287
|
+
test: Boolean(test),
|
|
5288
|
+
testScript: String(cli.flags['testScript'] || 'test')
|
|
5226
5289
|
});
|
|
5227
5290
|
}
|
|
5228
5291
|
|
|
@@ -5928,7 +5991,8 @@ async function run$A(argv, importMeta, {
|
|
|
5928
5991
|
const outputKind = utils.getOutputKind(json, markdown); // TODO: impl json/md further
|
|
5929
5992
|
const verbose = !!verboseFlag;
|
|
5930
5993
|
let [cwd = '.'] = cli.input;
|
|
5931
|
-
// Note: path.resolve vs .join:
|
|
5994
|
+
// Note: path.resolve vs .join:
|
|
5995
|
+
// If given path is absolute then cwd should not affect it.
|
|
5932
5996
|
cwd = path.resolve(process.cwd(), cwd);
|
|
5933
5997
|
if (verbose) {
|
|
5934
5998
|
logger.logger.group('- ', parentName, config$A.commandName, ':');
|
|
@@ -6043,7 +6107,8 @@ async function run$z(argv, importMeta, {
|
|
|
6043
6107
|
} = cli.flags;
|
|
6044
6108
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
6045
6109
|
let [cwd = '.'] = cli.input;
|
|
6046
|
-
// Note: path.resolve vs .join:
|
|
6110
|
+
// Note: path.resolve vs .join:
|
|
6111
|
+
// If given path is absolute then cwd should not affect it.
|
|
6047
6112
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6048
6113
|
const socketJson = await utils.readOrDefaultSocketJson(cwd);
|
|
6049
6114
|
|
|
@@ -6200,7 +6265,8 @@ async function run$y(argv, importMeta, {
|
|
|
6200
6265
|
} = cli.flags;
|
|
6201
6266
|
const outputKind = utils.getOutputKind(json, markdown); // TODO: impl json/md further
|
|
6202
6267
|
let [cwd = '.'] = cli.input;
|
|
6203
|
-
// Note: path.resolve vs .join:
|
|
6268
|
+
// Note: path.resolve vs .join:
|
|
6269
|
+
// If given path is absolute then cwd should not affect it.
|
|
6204
6270
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6205
6271
|
const socketJson = await utils.readOrDefaultSocketJson(cwd);
|
|
6206
6272
|
debug.debugLog('[DEBUG] socket.json gradle override:', socketJson?.defaults?.manifest?.gradle);
|
|
@@ -6356,7 +6422,8 @@ async function run$x(argv, importMeta, {
|
|
|
6356
6422
|
} = cli.flags;
|
|
6357
6423
|
const outputKind = utils.getOutputKind(json, markdown); // TODO: impl json/md further
|
|
6358
6424
|
let [cwd = '.'] = cli.input;
|
|
6359
|
-
// Note: path.resolve vs .join:
|
|
6425
|
+
// Note: path.resolve vs .join:
|
|
6426
|
+
// If given path is absolute then cwd should not affect it.
|
|
6360
6427
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6361
6428
|
const socketJson = await utils.readOrDefaultSocketJson(cwd);
|
|
6362
6429
|
debug.debugLog('[DEBUG] socket.json gradle override:', socketJson?.defaults?.manifest?.gradle);
|
|
@@ -6521,7 +6588,8 @@ async function run$w(argv, importMeta, {
|
|
|
6521
6588
|
} = cli.flags;
|
|
6522
6589
|
const outputKind = utils.getOutputKind(json, markdown); // TODO: impl json/md further
|
|
6523
6590
|
let [cwd = '.'] = cli.input;
|
|
6524
|
-
// Note: path.resolve vs .join:
|
|
6591
|
+
// Note: path.resolve vs .join:
|
|
6592
|
+
// If given path is absolute then cwd should not affect it.
|
|
6525
6593
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6526
6594
|
const socketJson = await utils.readOrDefaultSocketJson(cwd);
|
|
6527
6595
|
debug.debugLog('[DEBUG] socket.json sbt override:', socketJson?.defaults?.manifest?.sbt);
|
|
@@ -7078,7 +7146,8 @@ async function run$v(argv, importMeta, {
|
|
|
7078
7146
|
defaultOnReadError = false
|
|
7079
7147
|
} = cli.flags;
|
|
7080
7148
|
let [cwd = '.'] = cli.input;
|
|
7081
|
-
// Note: path.resolve vs .join:
|
|
7149
|
+
// Note: path.resolve vs .join:
|
|
7150
|
+
// If given path is absolute then cwd should not affect it.
|
|
7082
7151
|
cwd = path.resolve(process.cwd(), cwd);
|
|
7083
7152
|
if (cli.flags['dryRun']) {
|
|
7084
7153
|
logger.logger.log(DRY_RUN_BAILING_NOW$s);
|
|
@@ -13380,5 +13449,5 @@ void (async () => {
|
|
|
13380
13449
|
await utils.captureException(e);
|
|
13381
13450
|
}
|
|
13382
13451
|
})();
|
|
13383
|
-
//# debugId=
|
|
13452
|
+
//# debugId=e400d892-bcd3-4bf3-a6e0-ddafe9d984ad
|
|
13384
13453
|
//# sourceMappingURL=cli.js.map
|