socket 1.0.96 → 1.0.97
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 +164 -164
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-bin.js +3 -3
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-npm-inject.js +29 -49
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/shared.d.mts +2 -1
- package/dist/types/commands/fix/shared.d.mts.map +1 -1
- package/dist/types/shadow/npm/arborist/lib/arborist/index.d.mts.map +1 -1
- package/dist/types/shadow/npm/arborist-helpers.d.mts +5 -5
- package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
- package/dist/types/utils/alert/severity.d.mts.map +1 -1
- package/dist/types/utils/alerts-map.d.mts +4 -3
- package/dist/types/utils/alerts-map.d.mts.map +1 -1
- package/dist/types/utils/config.d.mts +5 -4
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/filter-config.d.mts +5 -0
- package/dist/types/utils/filter-config.d.mts.map +1 -0
- package/dist/types/utils/sdk.d.mts +3 -3
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/types/utils/socket-package-alert.d.mts +7 -5
- package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
- package/dist/utils.js +207 -207
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +38 -36
- package/external/@coana-tech/cli/cli-wrapper.mjs +1 -0
- package/external/@coana-tech/cli/cli.mjs +281 -172
- package/external/@coana-tech/cli/reachability-analyzers-cli.mjs +134 -63
- package/external/@coana-tech/cli/repos/coana-tech/alucard/alucard.jar +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/class-graph-analysis/dist/bundle/class-graph-analysis-cli.mjs +2337 -2821
- package/external/@coana-tech/cli/repos/coana-tech/cocoa/release/Coana.Cocoa.dll +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/external/@coana-tech/cli/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
- package/external/@socketsecurity/registry/lib/objects.js +16 -0
- package/package.json +6 -6
- package/dist/types/utils/strings.d.mts +0 -2
- package/dist/types/utils/strings.d.mts.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
var require$$0 = require('node:url');
|
|
5
5
|
var vendor = require('./vendor.js');
|
|
6
|
-
var require$$
|
|
6
|
+
var require$$8 = require('../external/@socketsecurity/registry/lib/debug');
|
|
7
7
|
var logger = require('../external/@socketsecurity/registry/lib/logger');
|
|
8
8
|
var utils = require('./utils.js');
|
|
9
9
|
var fs = require('node:fs/promises');
|
|
@@ -24,10 +24,10 @@ var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
|
24
24
|
var sorts = require('../external/@socketsecurity/registry/lib/sorts');
|
|
25
25
|
var regexps = require('../external/@socketsecurity/registry/lib/regexps');
|
|
26
26
|
var shadowNpmInject = require('./shadow-npm-inject.js');
|
|
27
|
-
var require$$
|
|
27
|
+
var require$$9 = require('../external/@socketsecurity/registry/lib/objects');
|
|
28
28
|
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
29
29
|
var shadowNpmBin = require('./shadow-npm-bin.js');
|
|
30
|
-
var require$$
|
|
30
|
+
var require$$10 = require('../external/@socketsecurity/registry/lib/promises');
|
|
31
31
|
var require$$1 = require('node:util');
|
|
32
32
|
var os = require('node:os');
|
|
33
33
|
var promises = require('node:stream/promises');
|
|
@@ -409,7 +409,7 @@ async function run$P(argv, importMeta, {
|
|
|
409
409
|
} = cli.flags;
|
|
410
410
|
const dryRun = !!cli.flags['dryRun'];
|
|
411
411
|
const noLegacy = !cli.flags['scope'] && !cli.flags['repo'] && !cli.flags['time'];
|
|
412
|
-
const hasApiToken = utils.
|
|
412
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
413
413
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
414
414
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
415
415
|
nook: true,
|
|
@@ -617,8 +617,8 @@ ${table}
|
|
|
617
617
|
} catch (e) {
|
|
618
618
|
process.exitCode = 1;
|
|
619
619
|
logger.logger.fail('There was a problem converting the logs to Markdown, please try the `--json` flag');
|
|
620
|
-
require$$
|
|
621
|
-
require$$
|
|
620
|
+
require$$8.debugFn('error', 'caught: markdown conversion error');
|
|
621
|
+
require$$8.debugDir('inspect', {
|
|
622
622
|
error: e
|
|
623
623
|
});
|
|
624
624
|
return 'Failed to generate the markdown report';
|
|
@@ -840,7 +840,7 @@ async function run$O(argv, importMeta, {
|
|
|
840
840
|
const noLegacy = !cli.flags['type'];
|
|
841
841
|
let [typeFilter = ''] = cli.input;
|
|
842
842
|
typeFilter = String(typeFilter);
|
|
843
|
-
const hasApiToken = utils.
|
|
843
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
844
844
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
845
845
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
846
846
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -1028,8 +1028,8 @@ async function fetchScanData(orgSlug, scanId, options) {
|
|
|
1028
1028
|
return JSON.parse(line);
|
|
1029
1029
|
} catch (e) {
|
|
1030
1030
|
ok = false;
|
|
1031
|
-
require$$
|
|
1032
|
-
require$$
|
|
1031
|
+
require$$8.debugFn('error', 'caught: JSON.parse error');
|
|
1032
|
+
require$$8.debugDir('inspect', {
|
|
1033
1033
|
error: e,
|
|
1034
1034
|
line
|
|
1035
1035
|
});
|
|
@@ -1676,28 +1676,28 @@ sockJson, cwd = process.cwd()) {
|
|
|
1676
1676
|
sbt: false
|
|
1677
1677
|
};
|
|
1678
1678
|
if (sockJson?.defaults?.manifest?.sbt?.disabled) {
|
|
1679
|
-
require$$
|
|
1679
|
+
require$$8.debugLog('notice', '[DEBUG] - sbt auto-detection is disabled in socket.json');
|
|
1680
1680
|
} else if (fs$1.existsSync(path.join(cwd, 'build.sbt'))) {
|
|
1681
|
-
require$$
|
|
1681
|
+
require$$8.debugLog('notice', '[DEBUG] - Detected a Scala sbt build file');
|
|
1682
1682
|
output.sbt = true;
|
|
1683
1683
|
output.count += 1;
|
|
1684
1684
|
}
|
|
1685
1685
|
if (sockJson?.defaults?.manifest?.gradle?.disabled) {
|
|
1686
|
-
require$$
|
|
1686
|
+
require$$8.debugLog('notice', '[DEBUG] - gradle auto-detection is disabled in socket.json');
|
|
1687
1687
|
} else if (fs$1.existsSync(path.join(cwd, 'gradlew'))) {
|
|
1688
|
-
require$$
|
|
1688
|
+
require$$8.debugLog('notice', '[DEBUG] - Detected a gradle build file');
|
|
1689
1689
|
output.gradle = true;
|
|
1690
1690
|
output.count += 1;
|
|
1691
1691
|
}
|
|
1692
1692
|
if (sockJson?.defaults?.manifest?.conda?.disabled) {
|
|
1693
|
-
require$$
|
|
1693
|
+
require$$8.debugLog('notice', '[DEBUG] - conda auto-detection is disabled in socket.json');
|
|
1694
1694
|
} else {
|
|
1695
1695
|
const envyml = path.join(cwd, 'environment.yml');
|
|
1696
1696
|
const hasEnvyml = fs$1.existsSync(envyml);
|
|
1697
1697
|
const envyaml = path.join(cwd, 'environment.yaml');
|
|
1698
1698
|
const hasEnvyaml = !hasEnvyml && fs$1.existsSync(envyaml);
|
|
1699
1699
|
if (hasEnvyml || hasEnvyaml) {
|
|
1700
|
-
require$$
|
|
1700
|
+
require$$8.debugLog('notice', '[DEBUG] - Detected an environment.yml Conda file');
|
|
1701
1701
|
output.conda = true;
|
|
1702
1702
|
output.count += 1;
|
|
1703
1703
|
}
|
|
@@ -2203,7 +2203,7 @@ async function handleCreateNewScan({
|
|
|
2203
2203
|
return;
|
|
2204
2204
|
}
|
|
2205
2205
|
logger.logger.success(`Found ${packagePaths.length} local ${words.pluralize('file', packagePaths.length)}`);
|
|
2206
|
-
require$$
|
|
2206
|
+
require$$8.debugDir('inspect', {
|
|
2207
2207
|
packagePaths
|
|
2208
2208
|
});
|
|
2209
2209
|
if (readOnly) {
|
|
@@ -2431,7 +2431,7 @@ async function discoverConfigValue(key) {
|
|
|
2431
2431
|
};
|
|
2432
2432
|
}
|
|
2433
2433
|
if (key === 'defaultOrg') {
|
|
2434
|
-
const hasApiToken = utils.
|
|
2434
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
2435
2435
|
if (!hasApiToken) {
|
|
2436
2436
|
return {
|
|
2437
2437
|
ok: false,
|
|
@@ -2461,7 +2461,7 @@ async function discoverConfigValue(key) {
|
|
|
2461
2461
|
};
|
|
2462
2462
|
}
|
|
2463
2463
|
if (key === 'enforcedOrgs') {
|
|
2464
|
-
const hasApiToken = utils.
|
|
2464
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
2465
2465
|
if (!hasApiToken) {
|
|
2466
2466
|
return {
|
|
2467
2467
|
ok: false,
|
|
@@ -3254,7 +3254,7 @@ async function coanaFix(fixConfig) {
|
|
|
3254
3254
|
lastCResult = fixCResult;
|
|
3255
3255
|
}
|
|
3256
3256
|
spinner?.stop();
|
|
3257
|
-
require$$
|
|
3257
|
+
require$$8.debugDir('inspect', {
|
|
3258
3258
|
lastCResult
|
|
3259
3259
|
});
|
|
3260
3260
|
return lastCResult.ok ? {
|
|
@@ -3366,15 +3366,15 @@ function getPrsForPurl(fixEnv, partialPurl) {
|
|
|
3366
3366
|
prs.push(pr);
|
|
3367
3367
|
}
|
|
3368
3368
|
}
|
|
3369
|
-
if (require$$
|
|
3369
|
+
if (require$$8.isDebug('notice,silly')) {
|
|
3370
3370
|
const fullName = packages.resolvePackageName(partialPurlObj);
|
|
3371
3371
|
if (prs.length) {
|
|
3372
|
-
require$$
|
|
3373
|
-
require$$
|
|
3372
|
+
require$$8.debugFn('notice', `found: ${prs.length} PRs for ${fullName}`);
|
|
3373
|
+
require$$8.debugDir('silly', {
|
|
3374
3374
|
prs
|
|
3375
3375
|
});
|
|
3376
3376
|
} else if (fixEnv.prs.length) {
|
|
3377
|
-
require$$
|
|
3377
|
+
require$$8.debugFn('notice', `miss: 0 PRs found for ${fullName}`);
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
3380
3380
|
return prs;
|
|
@@ -3388,14 +3388,14 @@ function getOctokit() {
|
|
|
3388
3388
|
SOCKET_CLI_GITHUB_TOKEN
|
|
3389
3389
|
} = constants.ENV;
|
|
3390
3390
|
if (!SOCKET_CLI_GITHUB_TOKEN) {
|
|
3391
|
-
require$$
|
|
3391
|
+
require$$8.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
|
|
3392
3392
|
}
|
|
3393
3393
|
const octokitOptions = {
|
|
3394
3394
|
auth: SOCKET_CLI_GITHUB_TOKEN,
|
|
3395
3395
|
// Lazily access constants.ENV.GITHUB_API_URL.
|
|
3396
3396
|
baseUrl: constants.ENV.GITHUB_API_URL
|
|
3397
3397
|
};
|
|
3398
|
-
require$$
|
|
3398
|
+
require$$8.debugDir('inspect', {
|
|
3399
3399
|
octokitOptions
|
|
3400
3400
|
});
|
|
3401
3401
|
_octokit = new vendor.Octokit(octokitOptions);
|
|
@@ -3410,7 +3410,7 @@ function getOctokitGraphql() {
|
|
|
3410
3410
|
SOCKET_CLI_GITHUB_TOKEN
|
|
3411
3411
|
} = constants.ENV;
|
|
3412
3412
|
if (!SOCKET_CLI_GITHUB_TOKEN) {
|
|
3413
|
-
require$$
|
|
3413
|
+
require$$8.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
|
|
3414
3414
|
}
|
|
3415
3415
|
_octokitGraphql = vendor.graphql2.defaults({
|
|
3416
3416
|
headers: {
|
|
@@ -3494,14 +3494,14 @@ async function cleanupPrs(owner, repo, options) {
|
|
|
3494
3494
|
pull_number: prNum,
|
|
3495
3495
|
state: 'closed'
|
|
3496
3496
|
});
|
|
3497
|
-
require$$
|
|
3497
|
+
require$$8.debugFn('notice', `pr: closing ${prRef} for ${prToVersion}`);
|
|
3498
3498
|
// Remove entry from parent object.
|
|
3499
3499
|
context.parent.splice(context.index, 1);
|
|
3500
3500
|
// Mark cache to be saved.
|
|
3501
3501
|
cachesToSave.set(context.cacheKey, context.data);
|
|
3502
3502
|
return null;
|
|
3503
3503
|
} catch (e) {
|
|
3504
|
-
require$$
|
|
3504
|
+
require$$8.debugFn('error', `pr: failed to close ${prRef} for ${prToVersion}\n`, e?.message || 'unknown error');
|
|
3505
3505
|
}
|
|
3506
3506
|
}
|
|
3507
3507
|
// Update stale PRs.
|
|
@@ -3514,7 +3514,7 @@ async function cleanupPrs(owner, repo, options) {
|
|
|
3514
3514
|
base: match.headRefName,
|
|
3515
3515
|
head: match.baseRefName
|
|
3516
3516
|
});
|
|
3517
|
-
require$$
|
|
3517
|
+
require$$8.debugFn('notice', `pr: updating stale ${prRef}`);
|
|
3518
3518
|
// Update entry entry.
|
|
3519
3519
|
if (context.apiType === 'graphql') {
|
|
3520
3520
|
context.entry.mergeStateStatus = 'CLEAN';
|
|
@@ -3525,7 +3525,7 @@ async function cleanupPrs(owner, repo, options) {
|
|
|
3525
3525
|
cachesToSave.set(context.cacheKey, context.data);
|
|
3526
3526
|
} catch (e) {
|
|
3527
3527
|
const message = e?.message || 'Unknown error';
|
|
3528
|
-
require$$
|
|
3528
|
+
require$$8.debugFn('error', `pr: failed to update ${prRef} - ${message}`);
|
|
3529
3529
|
}
|
|
3530
3530
|
}
|
|
3531
3531
|
return match;
|
|
@@ -3726,7 +3726,7 @@ async function openPr(owner, repo, branch, purl, newVersion, options) {
|
|
|
3726
3726
|
base: baseBranch,
|
|
3727
3727
|
body: getSocketPullRequestBody(purlObj, newVersion, workspace)
|
|
3728
3728
|
};
|
|
3729
|
-
require$$
|
|
3729
|
+
require$$8.debugDir('inspect', {
|
|
3730
3730
|
octokitPullsCreateParams
|
|
3731
3731
|
});
|
|
3732
3732
|
return await octokit.pulls.create(octokitPullsCreateParams);
|
|
@@ -3737,7 +3737,7 @@ async function openPr(owner, repo, branch, purl, newVersion, options) {
|
|
|
3737
3737
|
const details = errors.map(d => `- ${d.message?.trim() ?? `${d.resource}.${d.field} (${d.code})`}`).join('\n');
|
|
3738
3738
|
message += `:\n${details}`;
|
|
3739
3739
|
}
|
|
3740
|
-
require$$
|
|
3740
|
+
require$$8.debugFn('error', message);
|
|
3741
3741
|
}
|
|
3742
3742
|
return null;
|
|
3743
3743
|
}
|
|
@@ -3748,16 +3748,16 @@ async function setGitRemoteGithubRepoUrl(owner, repo, token, cwd = process.cwd()
|
|
|
3748
3748
|
const url = `https://x-access-token:${token}@${host}/${owner}/${repo}`;
|
|
3749
3749
|
const stdioIgnoreOptions = {
|
|
3750
3750
|
cwd,
|
|
3751
|
-
stdio: require$$
|
|
3751
|
+
stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
|
|
3752
3752
|
};
|
|
3753
3753
|
const quotedCmd = `\`git remote set-url origin ${url}\``;
|
|
3754
|
-
require$$
|
|
3754
|
+
require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
3755
3755
|
try {
|
|
3756
3756
|
await spawn.spawn('git', ['remote', 'set-url', 'origin', url], stdioIgnoreOptions);
|
|
3757
3757
|
return true;
|
|
3758
3758
|
} catch (e) {
|
|
3759
|
-
require$$
|
|
3760
|
-
require$$
|
|
3759
|
+
require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
|
|
3760
|
+
require$$8.debugDir('inspect', {
|
|
3761
3761
|
error: e
|
|
3762
3762
|
});
|
|
3763
3763
|
}
|
|
@@ -3770,7 +3770,7 @@ function ciRepoInfo() {
|
|
|
3770
3770
|
GITHUB_REPOSITORY
|
|
3771
3771
|
} = constants.ENV;
|
|
3772
3772
|
if (!GITHUB_REPOSITORY) {
|
|
3773
|
-
require$$
|
|
3773
|
+
require$$8.debugFn('notice', 'miss: GITHUB_REPOSITORY env var');
|
|
3774
3774
|
}
|
|
3775
3775
|
const ownerSlashRepo = GITHUB_REPOSITORY;
|
|
3776
3776
|
const slashIndex = ownerSlashRepo.indexOf('/');
|
|
@@ -3794,9 +3794,9 @@ async function getFixEnv() {
|
|
|
3794
3794
|
// but some CI checks are passing,
|
|
3795
3795
|
constants.ENV.CI || gitEmail || gitUser || githubToken) &&
|
|
3796
3796
|
// then log about it when in debug mode.
|
|
3797
|
-
require$$
|
|
3797
|
+
require$$8.isDebug('notice')) {
|
|
3798
3798
|
const envVars = [...(constants.ENV.CI ? [] : ['process.env.CI']), ...(gitEmail ? [] : ['process.env.SOCKET_CLI_GIT_USER_EMAIL']), ...(gitUser ? [] : ['process.env.SOCKET_CLI_GIT_USER_NAME']), ...(githubToken ? [] : ['process.env.GITHUB_TOKEN'])];
|
|
3799
|
-
require$$
|
|
3799
|
+
require$$8.debugFn('notice', `miss: fixEnv.isCi is false, expected ${arrays.joinAnd(envVars)} to be set`);
|
|
3800
3800
|
}
|
|
3801
3801
|
let repoInfo = null;
|
|
3802
3802
|
if (isCi) {
|
|
@@ -3804,7 +3804,7 @@ async function getFixEnv() {
|
|
|
3804
3804
|
}
|
|
3805
3805
|
if (!repoInfo) {
|
|
3806
3806
|
if (isCi) {
|
|
3807
|
-
require$$
|
|
3807
|
+
require$$8.debugFn('notice', 'falling back to `git remote get-url origin`');
|
|
3808
3808
|
}
|
|
3809
3809
|
repoInfo = await utils.getRepoInfo();
|
|
3810
3810
|
}
|
|
@@ -3936,7 +3936,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3936
3936
|
pkgPath: rootPath
|
|
3937
3937
|
} = pkgEnvDetails;
|
|
3938
3938
|
const fixEnv = await getFixEnv();
|
|
3939
|
-
require$$
|
|
3939
|
+
require$$8.debugDir('inspect', {
|
|
3940
3940
|
fixEnv
|
|
3941
3941
|
});
|
|
3942
3942
|
const {
|
|
@@ -3952,19 +3952,19 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3952
3952
|
} = fixConfig;
|
|
3953
3953
|
let count = 0;
|
|
3954
3954
|
const infoByPartialPurl = utils.getCveInfoFromAlertsMap(alertsMap, {
|
|
3955
|
-
|
|
3956
|
-
upgradable:
|
|
3955
|
+
filter: {
|
|
3956
|
+
upgradable: false
|
|
3957
3957
|
}
|
|
3958
3958
|
});
|
|
3959
3959
|
if (!infoByPartialPurl) {
|
|
3960
3960
|
spinner?.stop();
|
|
3961
3961
|
logger.logger.info('No fixable vulns found.');
|
|
3962
3962
|
if (alertsMap.size) {
|
|
3963
|
-
require$$
|
|
3963
|
+
require$$8.debugDir('inspect', {
|
|
3964
3964
|
alertsMap
|
|
3965
3965
|
});
|
|
3966
3966
|
} else {
|
|
3967
|
-
require$$
|
|
3967
|
+
require$$8.debugFn('inspect', '{ alertsMap: Map(0) {} }');
|
|
3968
3968
|
}
|
|
3969
3969
|
return {
|
|
3970
3970
|
ok: true,
|
|
@@ -3973,14 +3973,14 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
3973
3973
|
}
|
|
3974
3974
|
};
|
|
3975
3975
|
}
|
|
3976
|
-
if (require$$
|
|
3976
|
+
if (require$$8.isDebug('notice,inspect')) {
|
|
3977
3977
|
spinner?.stop();
|
|
3978
3978
|
const partialPurls = Array.from(infoByPartialPurl.keys());
|
|
3979
3979
|
const {
|
|
3980
3980
|
length: purlsCount
|
|
3981
3981
|
} = partialPurls;
|
|
3982
|
-
require$$
|
|
3983
|
-
require$$
|
|
3982
|
+
require$$8.debugFn('notice', `found: ${purlsCount} ${words.pluralize('PURL', purlsCount)} with CVEs`);
|
|
3983
|
+
require$$8.debugDir('inspect', {
|
|
3984
3984
|
partialPurls
|
|
3985
3985
|
});
|
|
3986
3986
|
spinner?.start();
|
|
@@ -4029,14 +4029,14 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4029
4029
|
const name = packages.resolvePackageName(partialPurlObj);
|
|
4030
4030
|
const infos = Array.from(infoEntry[1].values());
|
|
4031
4031
|
if (!infos.length) {
|
|
4032
|
-
require$$
|
|
4032
|
+
require$$8.debugFn('notice', `miss: CVEs expected, but not found, for ${name}`);
|
|
4033
4033
|
continue infoEntriesLoop;
|
|
4034
4034
|
}
|
|
4035
4035
|
logger.logger.log(`Processing '${name}'`);
|
|
4036
4036
|
logger.logger.indent();
|
|
4037
4037
|
spinner?.indent();
|
|
4038
4038
|
if (registry.getManifestData(partialPurlObj.type, name)) {
|
|
4039
|
-
require$$
|
|
4039
|
+
require$$8.debugFn('notice', `found: Socket Optimize variant for ${name}`);
|
|
4040
4040
|
}
|
|
4041
4041
|
// eslint-disable-next-line no-await-in-loop
|
|
4042
4042
|
const packument = await packages.fetchPackagePackument(name);
|
|
@@ -4046,7 +4046,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4046
4046
|
// Skip to next package.
|
|
4047
4047
|
continue infoEntriesLoop;
|
|
4048
4048
|
}
|
|
4049
|
-
require$$
|
|
4049
|
+
require$$8.debugDir('inspect', {
|
|
4050
4050
|
infos
|
|
4051
4051
|
});
|
|
4052
4052
|
const availableVersions = Object.keys(packument.versions);
|
|
@@ -4097,7 +4097,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4097
4097
|
}
|
|
4098
4098
|
const oldVersions = arrays.arrayUnique(shadowNpmInject.findPackageNodes(actualTree, name).map(n => n.version).filter(Boolean));
|
|
4099
4099
|
if (!oldVersions.length) {
|
|
4100
|
-
require$$
|
|
4100
|
+
require$$8.debugFn('notice', `skip: ${name} not found`);
|
|
4101
4101
|
cleanupInfoEntriesLoop();
|
|
4102
4102
|
// Skip to next package.
|
|
4103
4103
|
continue infoEntriesLoop;
|
|
@@ -4113,8 +4113,8 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4113
4113
|
const seenVersions = new Set();
|
|
4114
4114
|
let hasAnnouncedWorkspace = false;
|
|
4115
4115
|
let workspaceLogCallCount = logger.logger.logCallCount;
|
|
4116
|
-
if (require$$
|
|
4117
|
-
require$$
|
|
4116
|
+
if (require$$8.isDebug('notice')) {
|
|
4117
|
+
require$$8.debugFn('notice', `check: workspace ${workspace}`);
|
|
4118
4118
|
hasAnnouncedWorkspace = true;
|
|
4119
4119
|
workspaceLogCallCount = logger.logger.logCallCount;
|
|
4120
4120
|
}
|
|
@@ -4123,7 +4123,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4123
4123
|
const oldPurl = utils.idToPurl(oldId, partialPurlObj.type);
|
|
4124
4124
|
const node = shadowNpmInject.findPackageNode(actualTree, name, oldVersion);
|
|
4125
4125
|
if (!node) {
|
|
4126
|
-
require$$
|
|
4126
|
+
require$$8.debugFn('notice', `skip: ${oldId} not found`);
|
|
4127
4127
|
continue oldVersionsLoop;
|
|
4128
4128
|
}
|
|
4129
4129
|
infosLoop: for (const {
|
|
@@ -4143,7 +4143,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4143
4143
|
continue infosLoop;
|
|
4144
4144
|
}
|
|
4145
4145
|
if (vendor.semverExports.gte(oldVersion, newVersion)) {
|
|
4146
|
-
require$$
|
|
4146
|
+
require$$8.debugFn('silly', `skip: ${oldId} is >= ${newVersion}`);
|
|
4147
4147
|
continue infosLoop;
|
|
4148
4148
|
}
|
|
4149
4149
|
const branch = getSocketBranchName(oldPurl, newVersion, workspace);
|
|
@@ -4152,14 +4152,14 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4152
4152
|
}
|
|
4153
4153
|
const pr = prCheck ? prs.find(p => p.headRefName === branch) : undefined;
|
|
4154
4154
|
if (pr) {
|
|
4155
|
-
require$$
|
|
4155
|
+
require$$8.debugFn('notice', `skip: PR #${pr.number} for ${name}@${newVersion} exists`);
|
|
4156
4156
|
seenBranches.add(branch);
|
|
4157
4157
|
continue infosLoop;
|
|
4158
4158
|
}
|
|
4159
4159
|
if (fixEnv.isCi && (
|
|
4160
4160
|
// eslint-disable-next-line no-await-in-loop
|
|
4161
4161
|
await utils.gitRemoteBranchExists(branch, cwd))) {
|
|
4162
|
-
require$$
|
|
4162
|
+
require$$8.debugFn('notice', `skip: remote branch "${branch}" for ${name}@${newVersion} exists`);
|
|
4163
4163
|
seenBranches.add(branch);
|
|
4164
4164
|
continue infosLoop;
|
|
4165
4165
|
}
|
|
@@ -4188,7 +4188,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4188
4188
|
|
|
4189
4189
|
// eslint-disable-next-line no-await-in-loop
|
|
4190
4190
|
if (!(await hasModifiedFiles(cwd))) {
|
|
4191
|
-
require$$
|
|
4191
|
+
require$$8.debugFn('notice', `skip: no changes for ${name}@${newVersion}`);
|
|
4192
4192
|
seenVersions.add(newVersion);
|
|
4193
4193
|
// Reset things just in case.
|
|
4194
4194
|
if (fixEnv.isCi) {
|
|
@@ -4244,7 +4244,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4244
4244
|
|
|
4245
4245
|
// Check repoInfo to make TypeScript happy.
|
|
4246
4246
|
if (!errored && fixEnv.isCi && fixEnv.repoInfo) {
|
|
4247
|
-
require$$
|
|
4247
|
+
require$$8.debugFn('notice', 'pr: creating');
|
|
4248
4248
|
try {
|
|
4249
4249
|
const pushed =
|
|
4250
4250
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4329,7 +4329,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4329
4329
|
errored = true;
|
|
4330
4330
|
}
|
|
4331
4331
|
} else if (fixEnv.isCi) {
|
|
4332
|
-
require$$
|
|
4332
|
+
require$$8.debugFn('notice', 'skip: PR creation');
|
|
4333
4333
|
}
|
|
4334
4334
|
if (fixEnv.isCi) {
|
|
4335
4335
|
spinner?.start();
|
|
@@ -4381,7 +4381,7 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4381
4381
|
} else {
|
|
4382
4382
|
changed = true;
|
|
4383
4383
|
}
|
|
4384
|
-
require$$
|
|
4384
|
+
require$$8.debugFn('notice', 'increment: count', count + 1);
|
|
4385
4385
|
if (++count >= limit) {
|
|
4386
4386
|
cleanupInfoEntriesLoop();
|
|
4387
4387
|
// Exit main loop.
|
|
@@ -4421,14 +4421,12 @@ function getFixAlertsMapOptions(options = {}) {
|
|
|
4421
4421
|
__proto__: null,
|
|
4422
4422
|
consolidate: true,
|
|
4423
4423
|
nothrow: true,
|
|
4424
|
+
onlyFixable: true,
|
|
4424
4425
|
...options,
|
|
4425
|
-
|
|
4426
|
-
__proto__: null,
|
|
4426
|
+
filter: utils.toFilterConfig({
|
|
4427
4427
|
existing: true,
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
...options?.include
|
|
4431
|
-
}
|
|
4428
|
+
...require$$9.getOwn(options, 'filter')
|
|
4429
|
+
})
|
|
4432
4430
|
};
|
|
4433
4431
|
}
|
|
4434
4432
|
|
|
@@ -4441,7 +4439,7 @@ async function install$1(pkgEnvDetails, options) {
|
|
|
4441
4439
|
__proto__: null,
|
|
4442
4440
|
...options
|
|
4443
4441
|
};
|
|
4444
|
-
const useDebug = require$$
|
|
4442
|
+
const useDebug = require$$8.isDebug('stdio');
|
|
4445
4443
|
const args = [
|
|
4446
4444
|
// If "true", npm does not run scripts specified in package.json files.
|
|
4447
4445
|
// Note that commands explicitly intended to run a particular script, such
|
|
@@ -4472,7 +4470,7 @@ async function install$1(pkgEnvDetails, options) {
|
|
|
4472
4470
|
const wasSpinning = !!spinner?.isSpinning;
|
|
4473
4471
|
spinner?.stop();
|
|
4474
4472
|
const quotedCmd = `\`${pkgEnvDetails.agent} install ${args.join(' ')}\``;
|
|
4475
|
-
require$$
|
|
4473
|
+
require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
4476
4474
|
try {
|
|
4477
4475
|
await utils.runAgentInstall(pkgEnvDetails, {
|
|
4478
4476
|
args,
|
|
@@ -4483,8 +4481,8 @@ async function install$1(pkgEnvDetails, options) {
|
|
|
4483
4481
|
const result = {
|
|
4484
4482
|
error
|
|
4485
4483
|
};
|
|
4486
|
-
require$$
|
|
4487
|
-
require$$
|
|
4484
|
+
require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
|
|
4485
|
+
require$$8.debugDir('inspect', result);
|
|
4488
4486
|
return result;
|
|
4489
4487
|
}
|
|
4490
4488
|
const treeResult = await getActualTree(cwd);
|
|
@@ -4494,8 +4492,8 @@ async function install$1(pkgEnvDetails, options) {
|
|
|
4494
4492
|
}
|
|
4495
4493
|
return treeResult;
|
|
4496
4494
|
}
|
|
4497
|
-
require$$
|
|
4498
|
-
require$$
|
|
4495
|
+
require$$8.debugFn('error', 'caught: await arb.loadActual() error');
|
|
4496
|
+
require$$8.debugDir('inspect', treeResult);
|
|
4499
4497
|
if (wasSpinning) {
|
|
4500
4498
|
spinner.start();
|
|
4501
4499
|
}
|
|
@@ -4528,8 +4526,8 @@ async function npmFix(pkgEnvDetails, fixConfig) {
|
|
|
4528
4526
|
actualTree = await arb.reify();
|
|
4529
4527
|
} catch (e) {
|
|
4530
4528
|
spinner?.stop();
|
|
4531
|
-
require$$
|
|
4532
|
-
require$$
|
|
4529
|
+
require$$8.debugFn('error', 'caught: await arb.reify() error');
|
|
4530
|
+
require$$8.debugDir('inspect', {
|
|
4533
4531
|
error: e
|
|
4534
4532
|
});
|
|
4535
4533
|
return {
|
|
@@ -4542,8 +4540,8 @@ async function npmFix(pkgEnvDetails, fixConfig) {
|
|
|
4542
4540
|
}
|
|
4543
4541
|
} catch (e) {
|
|
4544
4542
|
spinner?.stop();
|
|
4545
|
-
require$$
|
|
4546
|
-
require$$
|
|
4543
|
+
require$$8.debugFn('error', 'caught: Socket batch PURL API error');
|
|
4544
|
+
require$$8.debugDir('inspect', {
|
|
4547
4545
|
error: e
|
|
4548
4546
|
});
|
|
4549
4547
|
return {
|
|
@@ -4650,19 +4648,19 @@ async function install(pkgEnvDetails, options) {
|
|
|
4650
4648
|
const wasSpinning = !!spinner?.isSpinning;
|
|
4651
4649
|
spinner?.stop();
|
|
4652
4650
|
const quotedCmd = `\`${pkgEnvDetails.agent} install ${args.join(' ')}\``;
|
|
4653
|
-
require$$
|
|
4651
|
+
require$$8.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
4654
4652
|
try {
|
|
4655
4653
|
await utils.runAgentInstall(pkgEnvDetails, {
|
|
4656
4654
|
args,
|
|
4657
4655
|
spinner,
|
|
4658
|
-
stdio: require$$
|
|
4656
|
+
stdio: require$$8.isDebug('stdio') ? 'inherit' : 'ignore'
|
|
4659
4657
|
});
|
|
4660
4658
|
} catch (error) {
|
|
4661
4659
|
const result = {
|
|
4662
4660
|
error
|
|
4663
4661
|
};
|
|
4664
|
-
require$$
|
|
4665
|
-
require$$
|
|
4662
|
+
require$$8.debugFn('error', `caught: ${quotedCmd} failed`);
|
|
4663
|
+
require$$8.debugDir('inspect', result);
|
|
4666
4664
|
return result;
|
|
4667
4665
|
}
|
|
4668
4666
|
const treeResult = await getActualTree(cwd);
|
|
@@ -4672,8 +4670,8 @@ async function install(pkgEnvDetails, options) {
|
|
|
4672
4670
|
}
|
|
4673
4671
|
return treeResult;
|
|
4674
4672
|
}
|
|
4675
|
-
require$$
|
|
4676
|
-
require$$
|
|
4673
|
+
require$$8.debugFn('error', 'caught: await arb.loadActual() error');
|
|
4674
|
+
require$$8.debugDir('inspect', treeResult);
|
|
4677
4675
|
if (wasSpinning) {
|
|
4678
4676
|
spinner.start();
|
|
4679
4677
|
}
|
|
@@ -4726,8 +4724,8 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4726
4724
|
alertsMap = purls.length ? await utils.getAlertsMapFromPurls(purls, getFixAlertsMapOptions()) : await utils.getAlertsMapFromPnpmLockfile(lockfile, getFixAlertsMapOptions());
|
|
4727
4725
|
} catch (e) {
|
|
4728
4726
|
spinner?.stop();
|
|
4729
|
-
require$$
|
|
4730
|
-
require$$
|
|
4727
|
+
require$$8.debugFn('error', 'caught: Socket batch PURL API error');
|
|
4728
|
+
require$$8.debugDir('inspect', {
|
|
4731
4729
|
error: e
|
|
4732
4730
|
});
|
|
4733
4731
|
return {
|
|
@@ -4755,7 +4753,7 @@ async function pnpmFix(pkgEnvDetails, fixConfig) {
|
|
|
4755
4753
|
revertOverrides = {
|
|
4756
4754
|
[PNPM$6]: oldPnpmSection ? {
|
|
4757
4755
|
...oldPnpmSection,
|
|
4758
|
-
[OVERRIDES$1]: require$$
|
|
4756
|
+
[OVERRIDES$1]: require$$9.hasKeys(oldOverrides) ? {
|
|
4759
4757
|
...oldOverrides,
|
|
4760
4758
|
[overrideKey]: undefined
|
|
4761
4759
|
} :
|
|
@@ -4883,7 +4881,7 @@ async function handleFix({
|
|
|
4883
4881
|
}, outputKind);
|
|
4884
4882
|
return;
|
|
4885
4883
|
}
|
|
4886
|
-
require$$
|
|
4884
|
+
require$$8.debugDir('inspect', {
|
|
4887
4885
|
pkgEnvDetails
|
|
4888
4886
|
});
|
|
4889
4887
|
|
|
@@ -5175,9 +5173,9 @@ async function setupTabCompletion(targetName) {
|
|
|
5175
5173
|
|
|
5176
5174
|
// Target dir is something like ~/.local/share/socket/settings/completion (linux)
|
|
5177
5175
|
const targetDir = path.dirname(targetPath);
|
|
5178
|
-
require$$
|
|
5176
|
+
require$$8.debugFn('notice', 'target: path + dir', targetPath, targetDir);
|
|
5179
5177
|
if (!fs$1.existsSync(targetDir)) {
|
|
5180
|
-
require$$
|
|
5178
|
+
require$$8.debugFn('notice', 'create: target dir');
|
|
5181
5179
|
fs$1.mkdirSync(targetDir, {
|
|
5182
5180
|
recursive: true
|
|
5183
5181
|
});
|
|
@@ -6086,7 +6084,7 @@ async function run$B(argv, importMeta, {
|
|
|
6086
6084
|
}
|
|
6087
6085
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
6088
6086
|
const detected = await detectManifestActions(sockJson, cwd);
|
|
6089
|
-
require$$
|
|
6087
|
+
require$$8.debugDir('inspect', {
|
|
6090
6088
|
detected
|
|
6091
6089
|
});
|
|
6092
6090
|
if (dryRun) {
|
|
@@ -6350,7 +6348,7 @@ async function run$z(argv, importMeta, {
|
|
|
6350
6348
|
// If given path is absolute then cwd should not affect it.
|
|
6351
6349
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6352
6350
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
6353
|
-
require$$
|
|
6351
|
+
require$$8.debugFn('inspect', 'override: socket.json gradle', sockJson?.defaults?.manifest?.gradle);
|
|
6354
6352
|
let {
|
|
6355
6353
|
bin,
|
|
6356
6354
|
gradleOpts,
|
|
@@ -6509,7 +6507,7 @@ async function run$y(argv, importMeta, {
|
|
|
6509
6507
|
// If given path is absolute then cwd should not affect it.
|
|
6510
6508
|
cwd = path.resolve(process.cwd(), cwd);
|
|
6511
6509
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
6512
|
-
require$$
|
|
6510
|
+
require$$8.debugFn('inspect', 'override: socket.json gradle', sockJson?.defaults?.manifest?.gradle);
|
|
6513
6511
|
let {
|
|
6514
6512
|
bin,
|
|
6515
6513
|
gradleOpts,
|
|
@@ -6675,7 +6673,7 @@ async function run$x(argv, importMeta, {
|
|
|
6675
6673
|
// TODO: Implement json/md further.
|
|
6676
6674
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
6677
6675
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
6678
|
-
require$$
|
|
6676
|
+
require$$8.debugFn('inspect', 'override: socket.json sbt', sockJson?.defaults?.manifest?.sbt);
|
|
6679
6677
|
let {
|
|
6680
6678
|
bin,
|
|
6681
6679
|
out,
|
|
@@ -6775,7 +6773,7 @@ async function outputManifestSetup(result) {
|
|
|
6775
6773
|
|
|
6776
6774
|
async function setupManifestConfig(cwd, defaultOnReadError = false) {
|
|
6777
6775
|
const detected = await detectManifestActions(null, cwd);
|
|
6778
|
-
require$$
|
|
6776
|
+
require$$8.debugDir('inspect', {
|
|
6779
6777
|
detected
|
|
6780
6778
|
});
|
|
6781
6779
|
|
|
@@ -7787,8 +7785,8 @@ function updatePkgJsonField(editablePkgJson, field, value) {
|
|
|
7787
7785
|
if (oldValue) {
|
|
7788
7786
|
// The field already exists so we simply update the field value.
|
|
7789
7787
|
if (field === PNPM$1) {
|
|
7790
|
-
const isPnpmObj = require$$
|
|
7791
|
-
if (require$$
|
|
7788
|
+
const isPnpmObj = require$$9.isObject(oldValue);
|
|
7789
|
+
if (require$$9.hasKeys(value)) {
|
|
7792
7790
|
editablePkgJson.update({
|
|
7793
7791
|
[field]: {
|
|
7794
7792
|
...(isPnpmObj ? oldValue : {}),
|
|
@@ -7800,7 +7798,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
|
|
|
7800
7798
|
});
|
|
7801
7799
|
} else {
|
|
7802
7800
|
// Properties with undefined values are deleted when saved as JSON.
|
|
7803
|
-
editablePkgJson.update(require$$
|
|
7801
|
+
editablePkgJson.update(require$$9.hasKeys(oldValue) ? {
|
|
7804
7802
|
[field]: {
|
|
7805
7803
|
...(isPnpmObj ? oldValue : {}),
|
|
7806
7804
|
overrides: undefined
|
|
@@ -7812,7 +7810,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
|
|
|
7812
7810
|
} else if (field === OVERRIDES || field === RESOLUTIONS) {
|
|
7813
7811
|
// Properties with undefined values are deleted when saved as JSON.
|
|
7814
7812
|
editablePkgJson.update({
|
|
7815
|
-
[field]: require$$
|
|
7813
|
+
[field]: require$$9.hasKeys(value) ? value : undefined
|
|
7816
7814
|
});
|
|
7817
7815
|
} else {
|
|
7818
7816
|
editablePkgJson.update({
|
|
@@ -7821,7 +7819,7 @@ function updatePkgJsonField(editablePkgJson, field, value) {
|
|
|
7821
7819
|
}
|
|
7822
7820
|
return;
|
|
7823
7821
|
}
|
|
7824
|
-
if ((field === OVERRIDES || field === PNPM$1 || field === RESOLUTIONS) && !require$$
|
|
7822
|
+
if ((field === OVERRIDES || field === PNPM$1 || field === RESOLUTIONS) && !require$$9.hasKeys(value)) {
|
|
7825
7823
|
return;
|
|
7826
7824
|
}
|
|
7827
7825
|
// Since the field doesn't exist we want to insert it into the package.json
|
|
@@ -7956,7 +7954,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7956
7954
|
let loggedAddingText = false;
|
|
7957
7955
|
|
|
7958
7956
|
// Chunk package names to process them in parallel 3 at a time.
|
|
7959
|
-
await require$$
|
|
7957
|
+
await require$$10.pEach(manifestEntries, async ({
|
|
7960
7958
|
1: data
|
|
7961
7959
|
}) => {
|
|
7962
7960
|
const {
|
|
@@ -7970,11 +7968,11 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7970
7968
|
for (const {
|
|
7971
7969
|
1: depObj
|
|
7972
7970
|
} of depEntries) {
|
|
7973
|
-
const sockSpec = require$$
|
|
7971
|
+
const sockSpec = require$$9.hasOwn(depObj, sockRegPkgName) ? depObj[sockRegPkgName] : undefined;
|
|
7974
7972
|
if (sockSpec) {
|
|
7975
7973
|
depAliasMap.set(sockRegPkgName, sockSpec);
|
|
7976
7974
|
}
|
|
7977
|
-
const origSpec = require$$
|
|
7975
|
+
const origSpec = require$$9.hasOwn(depObj, origPkgName) ? depObj[origPkgName] : undefined;
|
|
7978
7976
|
if (origSpec) {
|
|
7979
7977
|
let thisSpec = origSpec;
|
|
7980
7978
|
// Add package aliases for direct dependencies to avoid npm EOVERRIDE
|
|
@@ -8010,11 +8008,11 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
8010
8008
|
npmExecPath
|
|
8011
8009
|
});
|
|
8012
8010
|
// Chunk package names to process them in parallel 3 at a time.
|
|
8013
|
-
await require$$
|
|
8011
|
+
await require$$10.pEach(overridesDataObjects, async ({
|
|
8014
8012
|
overrides,
|
|
8015
8013
|
type
|
|
8016
8014
|
}) => {
|
|
8017
|
-
const overrideExists = require$$
|
|
8015
|
+
const overrideExists = require$$9.hasOwn(overrides, origPkgName);
|
|
8018
8016
|
if (overrideExists || thingScanner(pkgEnvDetails, thingToScan, origPkgName, lockName)) {
|
|
8019
8017
|
const oldSpec = overrideExists ? overrides[origPkgName] : undefined;
|
|
8020
8018
|
const origDepAlias = depAliasMap.get(origPkgName);
|
|
@@ -8068,7 +8066,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
8068
8066
|
});
|
|
8069
8067
|
if (isWorkspace) {
|
|
8070
8068
|
// Chunk package names to process them in parallel 3 at a time.
|
|
8071
|
-
await require$$
|
|
8069
|
+
await require$$10.pEach(workspacePkgJsonPaths, async workspacePkgJsonPath => {
|
|
8072
8070
|
const otherState = await addOverrides(pkgEnvDetails, path.dirname(workspacePkgJsonPath), {
|
|
8073
8071
|
logger,
|
|
8074
8072
|
pin,
|
|
@@ -8091,7 +8089,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
8091
8089
|
overrides,
|
|
8092
8090
|
type
|
|
8093
8091
|
} of overridesDataObjects) {
|
|
8094
|
-
updateManifest(type, pkgEnvDetails.editablePkgJson, require$$
|
|
8092
|
+
updateManifest(type, pkgEnvDetails.editablePkgJson, require$$9.toSortedObject(overrides));
|
|
8095
8093
|
}
|
|
8096
8094
|
}
|
|
8097
8095
|
await pkgEnvDetails.editablePkgJson.save();
|
|
@@ -8123,8 +8121,8 @@ async function updateLockfile(pkgEnvDetails, options) {
|
|
|
8123
8121
|
}
|
|
8124
8122
|
} catch (e) {
|
|
8125
8123
|
spinner?.stop();
|
|
8126
|
-
require$$
|
|
8127
|
-
require$$
|
|
8124
|
+
require$$8.debugFn('error', 'fail: update');
|
|
8125
|
+
require$$8.debugDir('inspect', {
|
|
8128
8126
|
error: e
|
|
8129
8127
|
});
|
|
8130
8128
|
if (wasSpinning) {
|
|
@@ -8503,7 +8501,7 @@ async function run$q(argv, importMeta, {
|
|
|
8503
8501
|
offset
|
|
8504
8502
|
} = cli.flags;
|
|
8505
8503
|
const dryRun = !!cli.flags['dryRun'];
|
|
8506
|
-
const hasApiToken = utils.
|
|
8504
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
8507
8505
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
8508
8506
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
8509
8507
|
nook: true,
|
|
@@ -8642,7 +8640,7 @@ async function run$p(argv, importMeta, {
|
|
|
8642
8640
|
} = cli.flags;
|
|
8643
8641
|
const dryRun = !!cli.flags['dryRun'];
|
|
8644
8642
|
const interactive = !!cli.flags['interactive'];
|
|
8645
|
-
const hasApiToken = utils.
|
|
8643
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
8646
8644
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
8647
8645
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
8648
8646
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -8779,7 +8777,7 @@ async function run$o(argv, importMeta, {
|
|
|
8779
8777
|
} = cli.flags;
|
|
8780
8778
|
const dryRun = !!cli.flags['dryRun'];
|
|
8781
8779
|
const interactive = !!cli.flags['interactive'];
|
|
8782
|
-
const hasApiToken = utils.
|
|
8780
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
8783
8781
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
8784
8782
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
8785
8783
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -8903,7 +8901,7 @@ async function run$n(argv, importMeta, {
|
|
|
8903
8901
|
markdown
|
|
8904
8902
|
} = cli.flags;
|
|
8905
8903
|
const dryRun = !!cli.flags['dryRun'];
|
|
8906
|
-
const hasApiToken = utils.
|
|
8904
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
8907
8905
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
8908
8906
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
8909
8907
|
nook: true,
|
|
@@ -9036,7 +9034,7 @@ async function run$m(argv, importMeta, {
|
|
|
9036
9034
|
const dryRun = !!cli.flags['dryRun'];
|
|
9037
9035
|
const json = Boolean(cli.flags['json']);
|
|
9038
9036
|
const markdown = Boolean(cli.flags['markdown']);
|
|
9039
|
-
const hasApiToken = utils.
|
|
9037
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
9040
9038
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
9041
9039
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
9042
9040
|
nook: true,
|
|
@@ -9385,7 +9383,7 @@ async function run$l(argv, importMeta, {
|
|
|
9385
9383
|
} = cli.flags;
|
|
9386
9384
|
const dryRun = !!cli.flags['dryRun'];
|
|
9387
9385
|
const [ecosystem = '', purl] = cli.input;
|
|
9388
|
-
const hasApiToken = utils.
|
|
9386
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
9389
9387
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
9390
9388
|
const {
|
|
9391
9389
|
purls,
|
|
@@ -9492,7 +9490,7 @@ function formatReportCard(artifact, colorize) {
|
|
|
9492
9490
|
colorize
|
|
9493
9491
|
});
|
|
9494
9492
|
if (!artifact.ecosystem) {
|
|
9495
|
-
require$$
|
|
9493
|
+
require$$8.debugFn('notice', 'miss: artifact ecosystem', artifact);
|
|
9496
9494
|
}
|
|
9497
9495
|
const purl = `pkg:${artifact.ecosystem}/${artifact.name}${artifact.version ? '@' + artifact.version : ''}`;
|
|
9498
9496
|
|
|
@@ -10115,7 +10113,7 @@ async function run$h(argv, importMeta, {
|
|
|
10115
10113
|
const interactive = !!cli.flags['interactive'];
|
|
10116
10114
|
const noLegacy = !cli.flags['repoName'];
|
|
10117
10115
|
const [repoName = ''] = cli.input;
|
|
10118
|
-
const hasApiToken = utils.
|
|
10116
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
10119
10117
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10120
10118
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
10121
10119
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -10252,7 +10250,7 @@ async function run$g(argv, importMeta, {
|
|
|
10252
10250
|
const interactive = !!cli.flags['interactive'];
|
|
10253
10251
|
const noLegacy = !cli.flags['repoName'];
|
|
10254
10252
|
const [repoName = ''] = cli.input;
|
|
10255
|
-
const hasApiToken = utils.
|
|
10253
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
10256
10254
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10257
10255
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
10258
10256
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -10545,7 +10543,7 @@ async function run$f(argv, importMeta, {
|
|
|
10545
10543
|
} = cli.flags;
|
|
10546
10544
|
const dryRun = !!cli.flags['dryRun'];
|
|
10547
10545
|
const interactive = !!cli.flags['interactive'];
|
|
10548
|
-
const hasApiToken = utils.
|
|
10546
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
10549
10547
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10550
10548
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
10551
10549
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -10741,7 +10739,7 @@ async function run$e(argv, importMeta, {
|
|
|
10741
10739
|
const interactive = !!cli.flags['interactive'];
|
|
10742
10740
|
const noLegacy = !cli.flags['repoName'];
|
|
10743
10741
|
const [repoName = ''] = cli.input;
|
|
10744
|
-
const hasApiToken = utils.
|
|
10742
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
10745
10743
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10746
10744
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
10747
10745
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -10904,7 +10902,7 @@ async function run$d(argv, importMeta, {
|
|
|
10904
10902
|
const interactive = !!cli.flags['interactive'];
|
|
10905
10903
|
const noLegacy = !cli.flags['repoName'];
|
|
10906
10904
|
const [repoName = ''] = cli.input;
|
|
10907
|
-
const hasApiToken = utils.
|
|
10905
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
10908
10906
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10909
10907
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
10910
10908
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -11265,7 +11263,7 @@ async function run$c(argv, importMeta, {
|
|
|
11265
11263
|
// We're going to need an api token to suggest data because those suggestions
|
|
11266
11264
|
// must come from data we already know. Don't error on missing api token yet.
|
|
11267
11265
|
// If the api-token is not set, ignore it for the sake of suggestions.
|
|
11268
|
-
const hasApiToken = utils.
|
|
11266
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
11269
11267
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
11270
11268
|
const pendingHead = tmp ? false : pendingHeadFlag;
|
|
11271
11269
|
|
|
@@ -11481,7 +11479,7 @@ async function run$b(argv, importMeta, {
|
|
|
11481
11479
|
const dryRun = !!cli.flags['dryRun'];
|
|
11482
11480
|
const interactive = !!cli.flags['interactive'];
|
|
11483
11481
|
const [scanId = ''] = cli.input;
|
|
11484
|
-
const hasApiToken = utils.
|
|
11482
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
11485
11483
|
const [orgSlug, defaultOrgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
11486
11484
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
11487
11485
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -11636,13 +11634,15 @@ async function handleMarkdown(data) {
|
|
|
11636
11634
|
logger.logger.log(` ... and ${data.artifacts.updated.length - 10} more`);
|
|
11637
11635
|
}
|
|
11638
11636
|
}
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11637
|
+
const unchanged = data.artifacts.unchanged ?? [];
|
|
11638
|
+
logger.logger.log(`- Unchanged packages: ${unchanged.length}`);
|
|
11639
|
+
if (unchanged.length > 0) {
|
|
11640
|
+
const firstUpToTen = unchanged.slice(0, 10);
|
|
11641
|
+
for (const artifact of firstUpToTen) {
|
|
11642
11642
|
logger.logger.log(` - ${artifact.type} ${artifact.name}@${artifact.version}`);
|
|
11643
|
-
}
|
|
11644
|
-
if (
|
|
11645
|
-
logger.logger.log(` ... and ${
|
|
11643
|
+
}
|
|
11644
|
+
if (unchanged.length > 10) {
|
|
11645
|
+
logger.logger.log(` ... and ${unchanged.length - 10} more`);
|
|
11646
11646
|
}
|
|
11647
11647
|
}
|
|
11648
11648
|
logger.logger.log('');
|
|
@@ -11789,7 +11789,7 @@ async function run$a(argv, importMeta, {
|
|
|
11789
11789
|
if (id2.startsWith(SOCKET_SBOM_URL_PREFIX)) {
|
|
11790
11790
|
id2 = id2.slice(SOCKET_SBOM_URL_PREFIX_LENGTH);
|
|
11791
11791
|
}
|
|
11792
|
-
const hasApiToken = utils.
|
|
11792
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
11793
11793
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
11794
11794
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
11795
11795
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -11968,7 +11968,7 @@ async function scanOneRepo(repoSlug, {
|
|
|
11968
11968
|
};
|
|
11969
11969
|
}
|
|
11970
11970
|
const tmpDir = fs$1.mkdtempSync(path.join(os.tmpdir(), repoSlug));
|
|
11971
|
-
require$$
|
|
11971
|
+
require$$8.debugFn('notice', 'init: temp dir for scan root', tmpDir);
|
|
11972
11972
|
const downloadResult = await testAndDownloadManifestFiles({
|
|
11973
11973
|
files,
|
|
11974
11974
|
tmpDir,
|
|
@@ -12089,11 +12089,11 @@ async function testAndDownloadManifestFile({
|
|
|
12089
12089
|
repoApiUrl,
|
|
12090
12090
|
tmpDir
|
|
12091
12091
|
}) {
|
|
12092
|
-
require$$
|
|
12092
|
+
require$$8.debugFn('notice', 'testing: file', file);
|
|
12093
12093
|
const supportedFilesCResult = await fetchSupportedScanFileNames();
|
|
12094
12094
|
const supportedFiles = supportedFilesCResult.ok ? supportedFilesCResult.data : undefined;
|
|
12095
12095
|
if (!supportedFiles || !utils.isReportSupportedFile(file, supportedFiles)) {
|
|
12096
|
-
require$$
|
|
12096
|
+
require$$8.debugFn('notice', ' - skip: not a known pattern');
|
|
12097
12097
|
// Not an error.
|
|
12098
12098
|
return {
|
|
12099
12099
|
ok: true,
|
|
@@ -12102,7 +12102,7 @@ async function testAndDownloadManifestFile({
|
|
|
12102
12102
|
}
|
|
12103
12103
|
};
|
|
12104
12104
|
}
|
|
12105
|
-
require$$
|
|
12105
|
+
require$$8.debugFn('notice', 'found: manifest file, going to attempt to download it;', file);
|
|
12106
12106
|
const result = await downloadManifestFile({
|
|
12107
12107
|
file,
|
|
12108
12108
|
tmpDir,
|
|
@@ -12124,9 +12124,9 @@ async function downloadManifestFile({
|
|
|
12124
12124
|
repoApiUrl,
|
|
12125
12125
|
tmpDir
|
|
12126
12126
|
}) {
|
|
12127
|
-
require$$
|
|
12127
|
+
require$$8.debugFn('notice', 'request: download url from GitHub');
|
|
12128
12128
|
const fileUrl = `${repoApiUrl}/contents/${file}?ref=${defaultBranch}`;
|
|
12129
|
-
require$$
|
|
12129
|
+
require$$8.debugDir('inspect', {
|
|
12130
12130
|
fileUrl
|
|
12131
12131
|
});
|
|
12132
12132
|
const downloadUrlResponse = await fetch(fileUrl, {
|
|
@@ -12135,9 +12135,9 @@ async function downloadManifestFile({
|
|
|
12135
12135
|
Authorization: `Bearer ${githubToken}`
|
|
12136
12136
|
}
|
|
12137
12137
|
});
|
|
12138
|
-
require$$
|
|
12138
|
+
require$$8.debugFn('notice', 'complete: request');
|
|
12139
12139
|
const downloadUrlText = await downloadUrlResponse.text();
|
|
12140
|
-
require$$
|
|
12140
|
+
require$$8.debugFn('inspect', 'response: raw download url', downloadUrlText);
|
|
12141
12141
|
let downloadUrl;
|
|
12142
12142
|
try {
|
|
12143
12143
|
downloadUrl = JSON.parse(downloadUrlText).download_url;
|
|
@@ -12150,7 +12150,7 @@ async function downloadManifestFile({
|
|
|
12150
12150
|
};
|
|
12151
12151
|
}
|
|
12152
12152
|
const localPath = path.join(tmpDir, file);
|
|
12153
|
-
require$$
|
|
12153
|
+
require$$8.debugFn('notice', 'download: manifest file started', downloadUrl, '->', localPath);
|
|
12154
12154
|
|
|
12155
12155
|
// Now stream the file to that file...
|
|
12156
12156
|
const result = await streamDownloadWithFetch(localPath, downloadUrl);
|
|
@@ -12159,7 +12159,7 @@ async function downloadManifestFile({
|
|
|
12159
12159
|
logger.logger.fail(`Failed to download manifest file, skipping to next file. File: ${file}`);
|
|
12160
12160
|
return result;
|
|
12161
12161
|
}
|
|
12162
|
-
require$$
|
|
12162
|
+
require$$8.debugFn('notice', 'download: manifest file completed');
|
|
12163
12163
|
return {
|
|
12164
12164
|
ok: true,
|
|
12165
12165
|
data: undefined
|
|
@@ -12211,7 +12211,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
12211
12211
|
};
|
|
12212
12212
|
} catch (error) {
|
|
12213
12213
|
logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
|
|
12214
|
-
require$$
|
|
12214
|
+
require$$8.debugDir('inspect', {
|
|
12215
12215
|
error
|
|
12216
12216
|
});
|
|
12217
12217
|
|
|
@@ -12235,7 +12235,7 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
12235
12235
|
// If error was due to bad HTTP status
|
|
12236
12236
|
detailedError += ` (HTTP Status: ${response.status} ${response.statusText})`;
|
|
12237
12237
|
}
|
|
12238
|
-
require$$
|
|
12238
|
+
require$$8.debugFn('error', detailedError);
|
|
12239
12239
|
return {
|
|
12240
12240
|
ok: false,
|
|
12241
12241
|
message: 'Download Failed',
|
|
@@ -12252,14 +12252,14 @@ async function getLastCommitDetails({
|
|
|
12252
12252
|
}) {
|
|
12253
12253
|
logger.logger.info(`Requesting last commit for default branch ${defaultBranch} for ${orgGithub}/${repoSlug}...`);
|
|
12254
12254
|
const commitApiUrl = `${repoApiUrl}/commits?sha=${defaultBranch}&per_page=1`;
|
|
12255
|
-
require$$
|
|
12255
|
+
require$$8.debugFn('inspect', 'url: commit', commitApiUrl);
|
|
12256
12256
|
const commitResponse = await fetch(commitApiUrl, {
|
|
12257
12257
|
headers: {
|
|
12258
12258
|
Authorization: `Bearer ${githubToken}`
|
|
12259
12259
|
}
|
|
12260
12260
|
});
|
|
12261
12261
|
const commitText = await commitResponse.text();
|
|
12262
|
-
require$$
|
|
12262
|
+
require$$8.debugFn('inspect', 'response: commit', commitText);
|
|
12263
12263
|
let lastCommit;
|
|
12264
12264
|
try {
|
|
12265
12265
|
lastCommit = JSON.parse(commitText)?.[0];
|
|
@@ -12346,7 +12346,7 @@ async function getRepoDetails({
|
|
|
12346
12346
|
repoSlug
|
|
12347
12347
|
}) {
|
|
12348
12348
|
const repoApiUrl = `${githubApiUrl}/repos/${orgGithub}/${repoSlug}`;
|
|
12349
|
-
require$$
|
|
12349
|
+
require$$8.debugDir('inspect', {
|
|
12350
12350
|
repoApiUrl
|
|
12351
12351
|
});
|
|
12352
12352
|
const repoDetailsResponse = await fetch(repoApiUrl, {
|
|
@@ -12357,7 +12357,7 @@ async function getRepoDetails({
|
|
|
12357
12357
|
});
|
|
12358
12358
|
logger.logger.success(`Request completed.`);
|
|
12359
12359
|
const repoDetailsText = await repoDetailsResponse.text();
|
|
12360
|
-
require$$
|
|
12360
|
+
require$$8.debugFn('inspect', 'response: repo', repoDetailsText);
|
|
12361
12361
|
let repoDetails;
|
|
12362
12362
|
try {
|
|
12363
12363
|
repoDetails = JSON.parse(repoDetailsText);
|
|
@@ -12396,7 +12396,7 @@ async function getRepoBranchTree({
|
|
|
12396
12396
|
}) {
|
|
12397
12397
|
logger.logger.info(`Requesting default branch file tree; branch \`${defaultBranch}\`, repo \`${orgGithub}/${repoSlug}\`...`);
|
|
12398
12398
|
const treeApiUrl = `${repoApiUrl}/git/trees/${defaultBranch}?recursive=1`;
|
|
12399
|
-
require$$
|
|
12399
|
+
require$$8.debugFn('inspect', 'url: tree', treeApiUrl);
|
|
12400
12400
|
const treeResponse = await fetch(treeApiUrl, {
|
|
12401
12401
|
method: 'GET',
|
|
12402
12402
|
headers: {
|
|
@@ -12404,7 +12404,7 @@ async function getRepoBranchTree({
|
|
|
12404
12404
|
}
|
|
12405
12405
|
});
|
|
12406
12406
|
const treeText = await treeResponse.text();
|
|
12407
|
-
require$$
|
|
12407
|
+
require$$8.debugFn('inspect', 'response: tree', treeText);
|
|
12408
12408
|
let treeDetails;
|
|
12409
12409
|
try {
|
|
12410
12410
|
treeDetails = JSON.parse(treeText);
|
|
@@ -12433,7 +12433,7 @@ async function getRepoBranchTree({
|
|
|
12433
12433
|
};
|
|
12434
12434
|
}
|
|
12435
12435
|
if (!treeDetails.tree || !Array.isArray(treeDetails.tree)) {
|
|
12436
|
-
require$$
|
|
12436
|
+
require$$8.debugDir('inspect', {
|
|
12437
12437
|
treeDetails: {
|
|
12438
12438
|
tree: treeDetails.tree
|
|
12439
12439
|
}
|
|
@@ -12627,7 +12627,7 @@ async function run$9(argv, importMeta, {
|
|
|
12627
12627
|
// We're going to need an api token to suggest data because those suggestions
|
|
12628
12628
|
// must come from data we already know. Don't error on missing api token yet.
|
|
12629
12629
|
// If the api-token is not set, ignore it for the sake of suggestions.
|
|
12630
|
-
const hasSocketApiToken = utils.
|
|
12630
|
+
const hasSocketApiToken = utils.hasDefaultApiToken();
|
|
12631
12631
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
12632
12632
|
|
|
12633
12633
|
// If the current cwd is unknown and is used as a repo slug anyways, we will
|
|
@@ -12905,7 +12905,7 @@ async function run$8(argv, importMeta, {
|
|
|
12905
12905
|
const noLegacy = !cli.flags['repo'];
|
|
12906
12906
|
const [repo = '', branchArg = ''] = cli.input;
|
|
12907
12907
|
const branch = String(branchFlag || branchArg || '');
|
|
12908
|
-
const hasApiToken = utils.
|
|
12908
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
12909
12909
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
12910
12910
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
12911
12911
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -13065,7 +13065,7 @@ async function run$7(argv, importMeta, {
|
|
|
13065
13065
|
const dryRun = !!cli.flags['dryRun'];
|
|
13066
13066
|
const interactive = !!cli.flags['interactive'];
|
|
13067
13067
|
const [scanId = ''] = cli.input;
|
|
13068
|
-
const hasApiToken = utils.
|
|
13068
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
13069
13069
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
13070
13070
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
13071
13071
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -13277,7 +13277,7 @@ async function run$6(argv, importMeta, {
|
|
|
13277
13277
|
targets = await suggestTarget();
|
|
13278
13278
|
}
|
|
13279
13279
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
13280
|
-
const hasApiToken = utils.
|
|
13280
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
13281
13281
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
13282
13282
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
13283
13283
|
nook: true,
|
|
@@ -13426,7 +13426,7 @@ async function run$5(argv, importMeta, {
|
|
|
13426
13426
|
const dryRun = !!cli.flags['dryRun'];
|
|
13427
13427
|
const interactive = !!cli.flags['interactive'];
|
|
13428
13428
|
const [scanId = '', file = ''] = cli.input;
|
|
13429
|
-
const hasApiToken = utils.
|
|
13429
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
13430
13430
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
13431
13431
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
13432
13432
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -13848,8 +13848,8 @@ async function fetchScan(orgSlug, scanId) {
|
|
|
13848
13848
|
return JSON.parse(line);
|
|
13849
13849
|
} catch (e) {
|
|
13850
13850
|
ok = false;
|
|
13851
|
-
require$$
|
|
13852
|
-
require$$
|
|
13851
|
+
require$$8.debugFn('error', 'caught: JSON.parse error');
|
|
13852
|
+
require$$8.debugDir('inspect', {
|
|
13853
13853
|
error: e,
|
|
13854
13854
|
line
|
|
13855
13855
|
});
|
|
@@ -14036,7 +14036,7 @@ async function run$3(argv, importMeta, {
|
|
|
14036
14036
|
const dryRun = !!cli.flags['dryRun'];
|
|
14037
14037
|
const interactive = !!cli.flags['interactive'];
|
|
14038
14038
|
const [scanId = '', file = ''] = cli.input;
|
|
14039
|
-
const hasApiToken = utils.
|
|
14039
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
14040
14040
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
14041
14041
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
14042
14042
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -14475,7 +14475,7 @@ async function run$2(argv, importMeta, {
|
|
|
14475
14475
|
if (argSet.size) {
|
|
14476
14476
|
logger.logger.info(`Warning: ignoring these excessive args: ${Array.from(argSet).join(', ')}`);
|
|
14477
14477
|
}
|
|
14478
|
-
const hasApiToken = utils.
|
|
14478
|
+
const hasApiToken = utils.hasDefaultApiToken();
|
|
14479
14479
|
const [orgSlug] = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
14480
14480
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
14481
14481
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
@@ -14740,8 +14740,8 @@ Do you want to install "safe npm" (this will create an alias to the socket-npm c
|
|
|
14740
14740
|
}
|
|
14741
14741
|
}
|
|
14742
14742
|
} catch (e) {
|
|
14743
|
-
require$$
|
|
14744
|
-
require$$
|
|
14743
|
+
require$$8.debugFn('error', 'caught: tab completion setup error');
|
|
14744
|
+
require$$8.debugDir('inspect', {
|
|
14745
14745
|
error: e
|
|
14746
14746
|
});
|
|
14747
14747
|
// Ignore. Skip tab completion setup.
|
|
@@ -15048,8 +15048,8 @@ void (async () => {
|
|
|
15048
15048
|
});
|
|
15049
15049
|
} catch (e) {
|
|
15050
15050
|
process.exitCode = 1;
|
|
15051
|
-
require$$
|
|
15052
|
-
require$$
|
|
15051
|
+
require$$8.debugFn('error', 'Uncaught error (BAD!):');
|
|
15052
|
+
require$$8.debugDir('inspect', {
|
|
15053
15053
|
error: e
|
|
15054
15054
|
});
|
|
15055
15055
|
let errorBody;
|
|
@@ -15095,7 +15095,7 @@ void (async () => {
|
|
|
15095
15095
|
logger.logger.error('\n');
|
|
15096
15096
|
logger.logger.fail(utils.failMsgWithBadge(errorTitle, errorMessage));
|
|
15097
15097
|
if (errorBody) {
|
|
15098
|
-
require$$
|
|
15098
|
+
require$$8.debugDir('inspect', {
|
|
15099
15099
|
errorBody
|
|
15100
15100
|
});
|
|
15101
15101
|
}
|
|
@@ -15103,5 +15103,5 @@ void (async () => {
|
|
|
15103
15103
|
await utils.captureException(e);
|
|
15104
15104
|
}
|
|
15105
15105
|
})();
|
|
15106
|
-
//# debugId=
|
|
15106
|
+
//# debugId=6fac2505-850a-4521-994a-eda179c5047a
|
|
15107
15107
|
//# sourceMappingURL=cli.js.map
|