snyk 1.972.0 → 1.975.0
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/477.index.js +1 -1
- package/dist/cli/477.index.js.map +1 -1
- package/dist/cli/784.index.js +35 -14
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/895.index.js +18 -4
- package/dist/cli/895.index.js.map +1 -1
- package/dist/cli/917.index.js +156 -64
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac/local-execution/assert-iac-options-flag.d.ts +8 -4
- package/dist/cli/commands/test/iac/local-execution/process-results/cli-share-results.d.ts +3 -3
- package/dist/cli/commands/test/iac/local-execution/process-results/index.d.ts +3 -2
- package/dist/cli/commands/test/iac/local-execution/process-results/process-results.d.ts +2 -2
- package/dist/cli/commands/test/iac/local-execution/process-results/share-results-formatter.d.ts +2 -1
- package/dist/cli/commands/test/iac/local-execution/process-results/share-results.d.ts +3 -2
- package/dist/cli/commands/test/iac/local-execution/types.d.ts +2 -1
- package/dist/cli/commands/test/iac/meta.d.ts +11 -0
- package/dist/cli/commands/test/iac/scan.d.ts +1 -1
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/config/index.d.ts +1 -0
- package/dist/lib/formatters/iac-output/v2/formatters.d.ts +1 -1
- package/dist/lib/iac/envelope-formatters.d.ts +3 -2
- package/dist/lib/types.d.ts +1 -0
- package/help/cli-commands/container.md +2 -0
- package/help/cli-commands/iac-test.md +14 -0
- package/help/cli-commands/iac.md +2 -2
- package/package.json +1 -1
- package/dist/lib/iac/cli-share-results.d.ts +0 -11
package/dist/cli/477.index.js
CHANGED
|
@@ -43,7 +43,7 @@ const chalk_1 = __webpack_require__(32589);
|
|
|
43
43
|
const snyk_policy_1 = __webpack_require__(70535);
|
|
44
44
|
const config_1 = __webpack_require__(25425);
|
|
45
45
|
async function display(policy) {
|
|
46
|
-
const p = snyk_policy_1.demunge(policy, config_1.default.
|
|
46
|
+
const p = snyk_policy_1.demunge(policy, config_1.default.PUBLIC_VULN_DB_URL);
|
|
47
47
|
const delimiter = '\n\n------------------------\n';
|
|
48
48
|
let res = chalk_1.default.bold('Current Snyk policy, read from ' + policy.__filename + ' file') + '\n';
|
|
49
49
|
res += 'Modified: ' + policy.__modified + '\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"477.index.js","mappings":";;;;;;;;;;AAAA,0CAAsC;AACtC,oDAAmD;AACnD,4CAI0B;AAEX,KAAK,UAAU,aAAa,CAAC,IAAa;IACvD,IAAI;QACF,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAE7D,CAAC;QACF,OAAO,MAAM,wBAAO,CAAC,YAAY,CAAC,CAAC;KACpC;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,YAAyB,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC3B,YAAY,GAAG,IAAI,4BAAmB,EAAE,CAAC;SAC1C;aAAM;YACL,YAAY,GAAG,IAAI,gCAAuB,EAAE,CAAC;YAC7C,YAAY,CAAC,UAAU,GAAG,KAAK,CAAC;SACjC;QACD,MAAM,YAAY,CAAC;KACpB;AACH,CAAC;AAhBD,gCAgBC;;;;;;;;;;;ACxBD,2CAA0B;AAC1B,iDAAsC;AACtC,4CAA8B;AAEvB,KAAK,UAAU,OAAO,CAAC,MAAM;IAClC,MAAM,CAAC,GAAG,qBAAO,CAAC,MAAM,EAAE,gBAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"477.index.js","mappings":";;;;;;;;;;AAAA,0CAAsC;AACtC,oDAAmD;AACnD,4CAI0B;AAEX,KAAK,UAAU,aAAa,CAAC,IAAa;IACvD,IAAI;QACF,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAA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display-policy.ts"],"sourcesContent":["import * as policy from 'snyk-policy';\nimport { display } from '../../lib/display-policy';\nimport {\n FailedToLoadPolicyError,\n PolicyNotFoundError,\n CustomError,\n} from '../../lib/errors';\n\nexport default async function displayPolicy(path?: string): Promise<string> {\n try {\n const loadedPolicy = (await policy.load(path || process.cwd())) as Promise<\n string\n >;\n return await display(loadedPolicy);\n } catch (error) {\n let adaptedError: CustomError;\n if (error.code === 'ENOENT') {\n adaptedError = new PolicyNotFoundError();\n } else {\n adaptedError = new FailedToLoadPolicyError();\n adaptedError.innerError = error;\n }\n throw adaptedError;\n }\n}\n","import chalk from 'chalk';\nimport { demunge } from 'snyk-policy';\nimport config from './config';\n\nexport async function display(policy) {\n const p = demunge(policy, config.PUBLIC_VULN_DB_URL);\n const delimiter = '\\n\\n------------------------\\n';\n\n let res =\n chalk.bold(\n 'Current Snyk policy, read from ' + policy.__filename + ' file',\n ) + '\\n';\n res += 'Modified: ' + policy.__modified + '\\n';\n res += 'Created: ' + policy.__created + '\\n';\n\n res += p.patch.map(displayRule('Patch vulnerability')).join('\\n');\n if (p.patch.length && p.ignore.length) {\n res += delimiter;\n }\n\n res += p.ignore.map(displayRule('Ignore')).join('\\n');\n if (p.ignore.length && p.exclude.length) {\n res += delimiter;\n }\n\n res += p.exclude.map(displayRule('Exclude')).join('\\n');\n\n return Promise.resolve(res);\n}\n\nfunction displayRule(title) {\n return (rule, i) => {\n i += 1;\n\n const formattedTitle =\n title === 'Exclude'\n ? chalk.bold(`\\n#${i} ${title}`) +\n ` the following ${chalk.bold(rule.id)} items/paths:\\n`\n : chalk.bold(`\\n#${i} ${title} ${rule.url}`) +\n ' in the following paths:\\n';\n\n return (\n formattedTitle +\n rule.paths\n .map((p) => {\n return (\n p.path +\n (p.reason\n ? '\\nReason: ' +\n p.reason +\n '\\nExpires: ' +\n p.expires.toUTCString() +\n '\\n'\n : '') +\n '\\n'\n );\n })\n .join('')\n .replace(/\\s*$/, '')\n );\n };\n}\n"],"names":[],"sourceRoot":""}
|
package/dist/cli/784.index.js
CHANGED
|
@@ -2318,7 +2318,7 @@ function formatScanResultsNewOutput(oldFormattedResults) {
|
|
|
2318
2318
|
});
|
|
2319
2319
|
return newFormattedResults;
|
|
2320
2320
|
}
|
|
2321
|
-
function formatSnykIacTestTestData(snykIacTestScanResult) {
|
|
2321
|
+
function formatSnykIacTestTestData(snykIacTestScanResult, projectName, orgName) {
|
|
2322
2322
|
const resultsBySeverity = formatSnykIacTestScanResultNewOutput(snykIacTestScanResult);
|
|
2323
2323
|
let totalIssues = 0;
|
|
2324
2324
|
const issuesCountBySeverity = {};
|
|
@@ -2327,21 +2327,46 @@ function formatSnykIacTestTestData(snykIacTestScanResult) {
|
|
|
2327
2327
|
issuesCountBySeverity[severity] = ((_a = resultsBySeverity[severity]) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
2328
2328
|
totalIssues += issuesCountBySeverity[severity];
|
|
2329
2329
|
});
|
|
2330
|
+
const allFilesCount = countFiles(snykIacTestScanResult);
|
|
2331
|
+
const filesWithIssuesCount = countFilesWithIssues(snykIacTestScanResult);
|
|
2332
|
+
const filesWithoutIssuesCount = allFilesCount - filesWithIssuesCount;
|
|
2330
2333
|
return {
|
|
2331
2334
|
resultsBySeverity,
|
|
2332
|
-
|
|
2333
|
-
metadata: { projectName: 'TBD', orgName: 'TBD' },
|
|
2334
|
-
// TODO: Add missing preoprties when adding support for the test summary
|
|
2335
|
+
metadata: { projectName, orgName },
|
|
2335
2336
|
counts: {
|
|
2336
2337
|
ignores: 0,
|
|
2337
|
-
filesWithIssues:
|
|
2338
|
-
filesWithoutIssues:
|
|
2338
|
+
filesWithIssues: filesWithIssuesCount,
|
|
2339
|
+
filesWithoutIssues: filesWithoutIssuesCount,
|
|
2339
2340
|
issues: totalIssues,
|
|
2340
2341
|
issuesBySeverity: issuesCountBySeverity,
|
|
2341
2342
|
},
|
|
2342
2343
|
};
|
|
2343
2344
|
}
|
|
2344
2345
|
exports.formatSnykIacTestTestData = formatSnykIacTestTestData;
|
|
2346
|
+
function countFilesWithIssues(results) {
|
|
2347
|
+
if (results && results.vulnerabilities) {
|
|
2348
|
+
const files = new Set();
|
|
2349
|
+
for (const vulnerability of results.vulnerabilities) {
|
|
2350
|
+
if (vulnerability.resource.file) {
|
|
2351
|
+
files.add(vulnerability.resource.file);
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
return files.size;
|
|
2355
|
+
}
|
|
2356
|
+
return 0;
|
|
2357
|
+
}
|
|
2358
|
+
function countFiles(results) {
|
|
2359
|
+
if (results && (results === null || results === void 0 ? void 0 : results.resources)) {
|
|
2360
|
+
const files = new Set();
|
|
2361
|
+
for (const resource of results.resources) {
|
|
2362
|
+
if (resource.file) {
|
|
2363
|
+
files.add(resource.file);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
return files.size;
|
|
2367
|
+
}
|
|
2368
|
+
return 0;
|
|
2369
|
+
}
|
|
2345
2370
|
function formatSnykIacTestScanResultNewOutput(snykIacTestScanResult) {
|
|
2346
2371
|
const resultsBySeverity = {};
|
|
2347
2372
|
if (snykIacTestScanResult === null || snykIacTestScanResult === void 0 ? void 0 : snykIacTestScanResult.vulnerabilities) {
|
|
@@ -2541,11 +2566,6 @@ const config_1 = __webpack_require__(25425);
|
|
|
2541
2566
|
const os_1 = __webpack_require__(12087);
|
|
2542
2567
|
const utils_1 = __webpack_require__(67533);
|
|
2543
2568
|
function formatShareResultsOutput(iacOutputMeta) {
|
|
2544
|
-
let projectName = iacOutputMeta.projectName;
|
|
2545
|
-
if (iacOutputMeta.gitRemoteUrl) {
|
|
2546
|
-
// from "http://github.com/snyk/cli.git" to "snyk/cli"
|
|
2547
|
-
projectName = iacOutputMeta.gitRemoteUrl.replace(/^https?:\/\/github.com\/(.*)\.git$/, '$1');
|
|
2548
|
-
}
|
|
2549
2569
|
return (utils_1.colors.title('Report Complete') +
|
|
2550
2570
|
os_1.EOL +
|
|
2551
2571
|
os_1.EOL +
|
|
@@ -2555,7 +2575,7 @@ function formatShareResultsOutput(iacOutputMeta) {
|
|
|
2555
2575
|
os_1.EOL +
|
|
2556
2576
|
utils_1.contentPadding +
|
|
2557
2577
|
'under the name: ' +
|
|
2558
|
-
utils_1.colors.title(projectName));
|
|
2578
|
+
utils_1.colors.title(iacOutputMeta.projectName));
|
|
2559
2579
|
}
|
|
2560
2580
|
exports.formatShareResultsOutput = formatShareResultsOutput;
|
|
2561
2581
|
exports.shareResultsTip = utils_1.colors.title('Tip') +
|
|
@@ -2761,7 +2781,8 @@ function formatIssues(vuln, options) {
|
|
|
2761
2781
|
}),
|
|
2762
2782
|
introducedThrough: ' Introduced through: ' + uniquePackages,
|
|
2763
2783
|
description: ' Description: ' + vuln.title,
|
|
2764
|
-
info: ' Info: ' +
|
|
2784
|
+
info: ' Info: ' +
|
|
2785
|
+
chalk_1.default.underline(config_1.default.PUBLIC_VULN_DB_URL + '/vuln/' + vulnID),
|
|
2765
2786
|
fromPaths: createTruncatedVulnsPathsText(vuln.list, options.showVulnPaths),
|
|
2766
2787
|
extraInfo: vuln.note ? chalk_1.default.bold('\n Note: ' + vuln.note) : '',
|
|
2767
2788
|
remediationInfo: vuln.metadata.type !== 'license' && localPackageTest
|
|
@@ -3194,7 +3215,7 @@ function formatIssue(id, title, severity, isNew, vulnerableModule, paths, testOp
|
|
|
3194
3215
|
}
|
|
3195
3216
|
return (common_1.colorTextBySeverity(severity, ` ${theme_1.icon.ISSUE} ${chalk_1.default.bold(title)}${newBadge} [${titleCaseText(severity)} Severity${originalSeverityStr}]`) +
|
|
3196
3217
|
reachabilityText +
|
|
3197
|
-
`[${config_1.default.
|
|
3218
|
+
`[${config_1.default.PUBLIC_VULN_DB_URL}/vuln/${id}]` +
|
|
3198
3219
|
name +
|
|
3199
3220
|
reachableVia +
|
|
3200
3221
|
introducedBy +
|