@contrast/contrast 1.0.15 → 1.0.17
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/audit/catalogueApplication/catalogueApplication.js +1 -1
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js +2 -2
- package/dist/audit/report/commonReportingFunctions.js +1 -19
- package/dist/{constants.js → cliConstants.js} +47 -32
- package/dist/commands/audit/auditConfig.js +10 -12
- package/dist/commands/audit/auditController.js +12 -16
- package/dist/commands/audit/help.js +24 -26
- package/dist/commands/audit/processAudit.js +16 -22
- package/dist/commands/audit/saveFile.js +3 -9
- package/dist/commands/auth/auth.js +1 -1
- package/dist/commands/config/config.js +1 -1
- package/dist/commands/scan/processScan.js +5 -7
- package/dist/commands/scan/sca/scaAnalysis.js +118 -89
- package/dist/common/HTTPClient.js +4 -2
- package/dist/common/commonHelp.js +35 -17
- package/dist/common/errorHandling.js +28 -57
- package/dist/common/versionChecker.js +24 -27
- package/dist/constants/constants.js +1 -1
- package/dist/constants/locales.js +11 -33
- package/dist/index.js +5 -5
- package/dist/lambda/help.js +2 -1
- package/dist/lambda/lambda.js +2 -7
- package/dist/scaAnalysis/common/auditReport.js +3 -2
- package/dist/scaAnalysis/common/scaParserForGoAndJava.js +1 -1
- package/dist/scaAnalysis/java/analysis.js +40 -5
- package/dist/scaAnalysis/java/index.js +15 -2
- package/dist/scaAnalysis/javascript/scaServiceParser.js +2 -2
- package/dist/scaAnalysis/php/phpNewServicesMapper.js +3 -3
- package/dist/scaAnalysis/python/analysis.js +1 -1
- package/dist/scaAnalysis/repoMode/gradleParser.js +75 -0
- package/dist/scaAnalysis/repoMode/index.js +21 -0
- package/dist/scaAnalysis/repoMode/mavenParser.js +76 -0
- package/dist/scaAnalysis/ruby/analysis.js +4 -4
- package/dist/scan/autoDetection.js +12 -3
- package/dist/scan/fileUtils.js +24 -1
- package/dist/scan/help.js +3 -2
- package/dist/scan/saveResults.js +1 -1
- package/dist/scan/scanConfig.js +1 -1
- package/dist/utils/commonApi.js +10 -1
- package/dist/utils/generalAPI.js +1 -2
- package/dist/utils/paramsUtil/configStoreParams.js +12 -1
- package/dist/utils/paramsUtil/paramHandler.js +7 -1
- package/dist/utils/saveFile.js +2 -1
- package/package.json +3 -1
- package/src/audit/catalogueApplication/catalogueApplication.js +1 -1
- package/src/audit/languageAnalysisEngine/sendSnapshot.js +2 -6
- package/src/audit/report/commonReportingFunctions.js +1 -23
- package/src/{constants.js → cliConstants.js} +53 -36
- package/src/commands/audit/auditConfig.js +19 -0
- package/src/commands/audit/{auditController.ts → auditController.js} +17 -12
- package/src/commands/audit/{help.ts → help.js} +10 -7
- package/src/commands/audit/processAudit.js +37 -0
- package/src/commands/audit/{saveFile.ts → saveFile.js} +2 -2
- package/src/commands/auth/auth.js +1 -1
- package/src/commands/config/config.js +1 -1
- package/src/commands/scan/processScan.js +4 -10
- package/src/commands/scan/sca/scaAnalysis.js +146 -118
- package/src/common/HTTPClient.js +4 -2
- package/src/common/commonHelp.js +43 -0
- package/src/common/{errorHandling.ts → errorHandling.js} +6 -31
- package/src/common/{versionChecker.ts → versionChecker.js} +15 -10
- package/src/constants/constants.js +1 -1
- package/src/constants/locales.js +13 -47
- package/src/index.ts +1 -1
- package/src/lambda/help.ts +2 -1
- package/src/lambda/lambda.ts +2 -10
- package/src/scaAnalysis/common/auditReport.js +3 -4
- package/src/scaAnalysis/common/scaParserForGoAndJava.js +1 -1
- package/src/scaAnalysis/java/analysis.js +43 -10
- package/src/scaAnalysis/java/index.js +19 -2
- package/src/scaAnalysis/javascript/scaServiceParser.js +8 -2
- package/src/scaAnalysis/php/phpNewServicesMapper.js +3 -3
- package/src/scaAnalysis/python/analysis.js +1 -1
- package/src/scaAnalysis/repoMode/gradleParser.js +88 -0
- package/src/scaAnalysis/repoMode/index.js +21 -0
- package/src/scaAnalysis/repoMode/mavenParser.js +89 -0
- package/src/scaAnalysis/ruby/analysis.js +4 -4
- package/src/scan/autoDetection.js +14 -3
- package/src/scan/fileUtils.js +29 -1
- package/src/scan/help.js +3 -2
- package/src/scan/saveResults.js +1 -1
- package/src/scan/scanConfig.js +1 -1
- package/src/utils/commonApi.js +13 -1
- package/src/utils/generalAPI.js +1 -2
- package/src/utils/getConfig.ts +1 -0
- package/src/utils/paramsUtil/configStoreParams.js +14 -1
- package/src/utils/paramsUtil/paramHandler.js +9 -1
- package/src/utils/saveFile.js +2 -1
- package/src/commands/audit/auditConfig.ts +0 -21
- package/src/commands/audit/processAudit.ts +0 -40
- package/src/common/commonHelp.ts +0 -13
|
@@ -28,7 +28,7 @@ const getTimeout = config => {
|
|
|
28
28
|
return 300;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
const
|
|
31
|
+
const pollForSnapshotCompletion = async (config, snapshotId, reportSpinner) => {
|
|
32
32
|
const client = commonApi.getHttpClient(config);
|
|
33
33
|
const startTime = performance.now();
|
|
34
34
|
const timeout = getTimeout(config);
|
|
@@ -63,5 +63,5 @@ const pollForSnapshotCompletition = async (config, snapshotId, reportSpinner) =>
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
module.exports = {
|
|
66
|
-
|
|
66
|
+
pollForSnapshotCompletion
|
|
67
67
|
};
|
|
@@ -132,13 +132,7 @@ function buildBody(cveArray, advice) {
|
|
|
132
132
|
function getIssueRow(cveArray) {
|
|
133
133
|
orderByHighestPriority(cveArray);
|
|
134
134
|
const cveMessagesList = getIssueCveMsgList(cveArray);
|
|
135
|
-
|
|
136
|
-
const numAndSeverityTypeDesc = getNumOfAndSeverityType(cveNumbers);
|
|
137
|
-
return [
|
|
138
|
-
chalk.bold('Issue'),
|
|
139
|
-
':',
|
|
140
|
-
`${numAndSeverityTypeDesc} ${cveMessagesList.join(', ')}`
|
|
141
|
-
];
|
|
135
|
+
return [chalk.bold('Issue'), ':', `${cveMessagesList.join(', ')}`];
|
|
142
136
|
}
|
|
143
137
|
function gatherRemediationAdvice(guidance, libraryName, libraryVersion) {
|
|
144
138
|
const guidanceModel = new ReportGuidanceModel();
|
|
@@ -152,17 +146,6 @@ function gatherRemediationAdvice(guidance, libraryName, libraryVersion) {
|
|
|
152
146
|
function buildFormattedHeaderNum(contrastHeaderNum) {
|
|
153
147
|
return `CONTRAST-${contrastHeaderNum.toString().padStart(3, '0')}`;
|
|
154
148
|
}
|
|
155
|
-
function getNumOfAndSeverityType(cveNumbers) {
|
|
156
|
-
const { critical, high, medium, low, note } = cveNumbers;
|
|
157
|
-
const criticalMsg = critical > 0 ? `${critical} Critical | ` : '';
|
|
158
|
-
const highMsg = high > 0 ? `${high} High | ` : '';
|
|
159
|
-
const mediumMsg = medium > 0 ? `${medium} Medium | ` : '';
|
|
160
|
-
const lowMsg = low > 0 ? `${low} Low | ` : '';
|
|
161
|
-
const noteMsg = note > 0 ? `${note} Note` : '';
|
|
162
|
-
return `${criticalMsg} ${highMsg} ${mediumMsg} ${lowMsg} ${noteMsg}`
|
|
163
|
-
.replace(/\s+/g, ' ')
|
|
164
|
-
.trim();
|
|
165
|
-
}
|
|
166
149
|
const buildFooter = reportModelStructure => {
|
|
167
150
|
const { critical, high, medium, low, note } = countVulnerableLibrariesBySeverity(reportModelStructure);
|
|
168
151
|
const criticalMessage = chalk
|
|
@@ -257,7 +240,6 @@ module.exports = {
|
|
|
257
240
|
getIssueRow,
|
|
258
241
|
gatherRemediationAdvice,
|
|
259
242
|
buildFormattedHeaderNum,
|
|
260
|
-
getNumOfAndSeverityType,
|
|
261
243
|
getIssueCveMsgList,
|
|
262
244
|
getSeverityCounts,
|
|
263
245
|
printNoVulnFoundMsg,
|
|
@@ -10,7 +10,46 @@ i18n.configure({
|
|
|
10
10
|
},
|
|
11
11
|
defaultLocale: 'en'
|
|
12
12
|
});
|
|
13
|
+
const sharedOptionDefinitions = [
|
|
14
|
+
{
|
|
15
|
+
name: 'proxy',
|
|
16
|
+
description: '{bold ' +
|
|
17
|
+
i18n.__('constantsOptional') +
|
|
18
|
+
'}: ' +
|
|
19
|
+
i18n.__('constantsProxyServer')
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'key',
|
|
23
|
+
description: '{bold ' +
|
|
24
|
+
i18n.__('constantsOptional') +
|
|
25
|
+
'}: ' +
|
|
26
|
+
i18n.__('constantsProxyKey')
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'cacert',
|
|
30
|
+
description: '{bold ' +
|
|
31
|
+
i18n.__('constantsOptional') +
|
|
32
|
+
'}: ' +
|
|
33
|
+
i18n.__('constantsProxyCaCert')
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'cert',
|
|
37
|
+
description: '{bold ' +
|
|
38
|
+
i18n.__('constantsOptional') +
|
|
39
|
+
'}: ' +
|
|
40
|
+
i18n.__('constantsProxyCert')
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'ignore-cert-errors',
|
|
44
|
+
type: Boolean,
|
|
45
|
+
description: '{bold ' +
|
|
46
|
+
i18n.__('constantsOptional') +
|
|
47
|
+
'}:' +
|
|
48
|
+
i18n.__('constantsIgnoreCertErrors')
|
|
49
|
+
}
|
|
50
|
+
];
|
|
13
51
|
const scanOptionDefinitions = [
|
|
52
|
+
...sharedOptionDefinitions,
|
|
14
53
|
{
|
|
15
54
|
name: 'name',
|
|
16
55
|
alias: 'n',
|
|
@@ -88,13 +127,6 @@ const scanOptionDefinitions = [
|
|
|
88
127
|
'}: ' +
|
|
89
128
|
i18n.__('constantsHostId')
|
|
90
129
|
},
|
|
91
|
-
{
|
|
92
|
-
name: 'proxy',
|
|
93
|
-
description: '{bold ' +
|
|
94
|
-
i18n.__('constantsOptional') +
|
|
95
|
-
'}: ' +
|
|
96
|
-
i18n.__('constantsProxyServer')
|
|
97
|
-
},
|
|
98
130
|
{
|
|
99
131
|
name: 'fail',
|
|
100
132
|
type: Boolean,
|
|
@@ -117,15 +149,7 @@ const scanOptionDefinitions = [
|
|
|
117
149
|
description: '{bold ' +
|
|
118
150
|
i18n.__('constantsOptional') +
|
|
119
151
|
'}: ' +
|
|
120
|
-
i18n.__('
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: 'ignore-cert-errors',
|
|
124
|
-
type: Boolean,
|
|
125
|
-
description: '{bold ' +
|
|
126
|
-
i18n.__('constantsOptional') +
|
|
127
|
-
'}:' +
|
|
128
|
-
i18n.__('constantsIgnoreCertErrors')
|
|
152
|
+
i18n.__('constantsDoNotWaitForScan')
|
|
129
153
|
},
|
|
130
154
|
{
|
|
131
155
|
name: 'verbose',
|
|
@@ -190,6 +214,7 @@ const configOptionDefinitions = [
|
|
|
190
214
|
}
|
|
191
215
|
];
|
|
192
216
|
const auditOptionDefinitions = [
|
|
217
|
+
...sharedOptionDefinitions,
|
|
193
218
|
{
|
|
194
219
|
name: 'application-id',
|
|
195
220
|
description: '{bold ' +
|
|
@@ -270,6 +295,10 @@ const auditOptionDefinitions = [
|
|
|
270
295
|
{
|
|
271
296
|
name: 'maven-settings-path'
|
|
272
297
|
},
|
|
298
|
+
{
|
|
299
|
+
name: 'fingerprint',
|
|
300
|
+
type: Boolean
|
|
301
|
+
},
|
|
273
302
|
{
|
|
274
303
|
name: 'organization-id',
|
|
275
304
|
alias: 'o',
|
|
@@ -299,21 +328,6 @@ const auditOptionDefinitions = [
|
|
|
299
328
|
'}: ' +
|
|
300
329
|
i18n.__('constantsHostId')
|
|
301
330
|
},
|
|
302
|
-
{
|
|
303
|
-
name: 'proxy',
|
|
304
|
-
description: '{bold ' +
|
|
305
|
-
i18n.__('constantsOptional') +
|
|
306
|
-
'}: ' +
|
|
307
|
-
i18n.__('constantsProxyServer')
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: 'ignore-cert-errors',
|
|
311
|
-
type: Boolean,
|
|
312
|
-
description: '{bold ' +
|
|
313
|
-
i18n.__('constantsOptional') +
|
|
314
|
-
'}:' +
|
|
315
|
-
i18n.__('constantsIgnoreCertErrors')
|
|
316
|
-
},
|
|
317
331
|
{
|
|
318
332
|
name: 'save',
|
|
319
333
|
alias: 's',
|
|
@@ -402,7 +416,8 @@ const mainUsageGuide = commandLineUsage([
|
|
|
402
416
|
{ name: i18n.__('clearHeader'), summary: i18n.__('clearContent') }
|
|
403
417
|
]
|
|
404
418
|
},
|
|
405
|
-
commonHelpLinks()
|
|
419
|
+
commonHelpLinks()[0],
|
|
420
|
+
commonHelpLinks()[1]
|
|
406
421
|
]);
|
|
407
422
|
const mainDefinition = [{ name: 'command', defaultOption: true }];
|
|
408
423
|
module.exports = {
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAuditConfig = void 0;
|
|
7
|
-
const paramHandler_1 = __importDefault(require("../../utils/paramsUtil/paramHandler"));
|
|
8
|
-
const constants_1 = __importDefault(require("../../constants"));
|
|
9
|
-
const parsedCLIOptions_1 = require("../../utils/parsedCLIOptions");
|
|
2
|
+
const { getCommandLineArgsCustom } = require('../../utils/parsedCLIOptions');
|
|
3
|
+
const constants = require('../../cliConstants');
|
|
4
|
+
const paramHandler = require('../../utils/paramsUtil/paramHandler');
|
|
10
5
|
const getAuditConfig = async (contrastConf, command, argv) => {
|
|
11
|
-
const auditParameters = await
|
|
12
|
-
const paramsAuth =
|
|
13
|
-
|
|
6
|
+
const auditParameters = await getCommandLineArgsCustom(contrastConf, command, argv, constants.commandLineDefinitions.auditOptionDefinitions);
|
|
7
|
+
const paramsAuth = paramHandler.getAuth(auditParameters);
|
|
8
|
+
const javaAgreement = paramHandler.getAgreement();
|
|
9
|
+
return { ...paramsAuth, ...auditParameters, ...javaAgreement };
|
|
10
|
+
};
|
|
11
|
+
module.exports = {
|
|
12
|
+
getAuditConfig
|
|
14
13
|
};
|
|
15
|
-
exports.getAuditConfig = getAuditConfig;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAppName = exports.dealWithNoAppId = void 0;
|
|
7
|
-
const catalogueApplication_1 = require("../../audit/catalogueApplication/catalogueApplication");
|
|
8
|
-
const commonApi_1 = __importDefault(require("../../audit/languageAnalysisEngine/commonApi"));
|
|
2
|
+
const catalogue = require('../../audit/catalogueApplication/catalogueApplication');
|
|
3
|
+
const commonApi = require('../../audit/languageAnalysisEngine/commonApi');
|
|
9
4
|
const dealWithNoAppId = async (config) => {
|
|
10
5
|
let appID;
|
|
11
6
|
try {
|
|
12
|
-
appID = await
|
|
7
|
+
appID = await commonApi.returnAppId(config);
|
|
13
8
|
if (!appID && config.applicationName) {
|
|
14
|
-
return await
|
|
9
|
+
return await catalogue.catalogueApplication(config);
|
|
15
10
|
}
|
|
16
11
|
if (!appID && !config.applicationName) {
|
|
17
|
-
config.applicationName =
|
|
18
|
-
appID = await
|
|
12
|
+
config.applicationName = getAppName(config.file);
|
|
13
|
+
appID = await commonApi.returnAppId(config);
|
|
19
14
|
if (!appID) {
|
|
20
|
-
return await
|
|
15
|
+
return await catalogue.catalogueApplication(config);
|
|
21
16
|
}
|
|
22
17
|
}
|
|
23
18
|
}
|
|
@@ -30,8 +25,7 @@ const dealWithNoAppId = async (config) => {
|
|
|
30
25
|
}
|
|
31
26
|
return appID;
|
|
32
27
|
};
|
|
33
|
-
|
|
34
|
-
const getAppName = (file) => {
|
|
28
|
+
const getAppName = file => {
|
|
35
29
|
const last = file.charAt(file.length - 1);
|
|
36
30
|
if (last !== '/') {
|
|
37
31
|
return file.split('/').pop();
|
|
@@ -41,7 +35,9 @@ const getAppName = (file) => {
|
|
|
41
35
|
return str.split('/').pop();
|
|
42
36
|
}
|
|
43
37
|
};
|
|
44
|
-
|
|
45
|
-
const removeLastChar = (str) => {
|
|
38
|
+
const removeLastChar = str => {
|
|
46
39
|
return str.substring(0, str.length - 1);
|
|
47
40
|
};
|
|
41
|
+
module.exports = {
|
|
42
|
+
dealWithNoAppId
|
|
43
|
+
};
|
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const command_line_usage_1 = __importDefault(require("command-line-usage"));
|
|
8
|
-
const i18n_1 = __importDefault(require("i18n"));
|
|
9
|
-
const constants_1 = __importDefault(require("../../constants"));
|
|
10
|
-
const commonHelp_1 = require("../../common/commonHelp");
|
|
11
|
-
const auditUsageGuide = (0, command_line_usage_1.default)([
|
|
2
|
+
const commandLineUsage = require('command-line-usage');
|
|
3
|
+
const i18n = require('i18n');
|
|
4
|
+
const constants = require('../../cliConstants');
|
|
5
|
+
const { commonHelpLinks } = require('../../common/commonHelp');
|
|
6
|
+
const auditUsageGuide = commandLineUsage([
|
|
12
7
|
{
|
|
13
|
-
header:
|
|
14
|
-
content: [
|
|
8
|
+
header: i18n.__('auditHeader'),
|
|
9
|
+
content: [i18n.__('auditHeaderMessage')]
|
|
15
10
|
},
|
|
16
11
|
{
|
|
17
|
-
header:
|
|
12
|
+
header: i18n.__('constantsPrerequisitesHeader'),
|
|
18
13
|
content: [
|
|
19
14
|
'{bold ' +
|
|
20
|
-
|
|
15
|
+
i18n.__('constantsAuditPrerequisitesContentSupportedLanguages') +
|
|
21
16
|
'}',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
i18n.__('constantsAuditPrerequisitesJavaContentMessage'),
|
|
18
|
+
i18n.__('constantsAuditPrerequisitesContentDotNetMessage'),
|
|
19
|
+
i18n.__('constantsAuditPrerequisitesContentNodeMessage'),
|
|
20
|
+
i18n.__('constantsAuditPrerequisitesContentRubyMessage'),
|
|
21
|
+
i18n.__('constantsAuditPrerequisitesContentPythonMessage'),
|
|
22
|
+
i18n.__('constantsAuditPrerequisitesContentGoMessage'),
|
|
23
|
+
i18n.__('constantsAuditPrerequisitesContentPHPMessage')
|
|
29
24
|
]
|
|
30
25
|
},
|
|
31
26
|
{
|
|
32
|
-
header:
|
|
33
|
-
optionList:
|
|
27
|
+
header: i18n.__('constantsAuditOptions'),
|
|
28
|
+
optionList: constants.commandLineDefinitions.auditOptionDefinitions,
|
|
34
29
|
hide: [
|
|
35
30
|
'application-id',
|
|
36
31
|
'application-name',
|
|
@@ -54,9 +49,12 @@ const auditUsageGuide = (0, command_line_usage_1.default)([
|
|
|
54
49
|
'app-groups',
|
|
55
50
|
'metadata',
|
|
56
51
|
'track',
|
|
57
|
-
'
|
|
52
|
+
'fingerprint'
|
|
58
53
|
]
|
|
59
54
|
},
|
|
60
|
-
(0,
|
|
55
|
+
commonHelpLinks()[0],
|
|
56
|
+
commonHelpLinks()[1]
|
|
61
57
|
]);
|
|
62
|
-
exports
|
|
58
|
+
module.exports = {
|
|
59
|
+
auditUsageGuide
|
|
60
|
+
};
|
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const scaAnalysis_1 = require("../scan/sca/scaAnalysis");
|
|
10
|
-
const telemetry_1 = require("../../telemetry/telemetry");
|
|
11
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
-
const processAudit = async (contrastConf, argv) => {
|
|
13
|
-
if (argv.indexOf('--help') != -1) {
|
|
2
|
+
const auditConfig = require('./auditConfig');
|
|
3
|
+
const { auditUsageGuide } = require('./help');
|
|
4
|
+
const scaController = require('../scan/sca/scaAnalysis');
|
|
5
|
+
const { sendTelemetryConfigAsObject } = require('../../telemetry/telemetry');
|
|
6
|
+
const { postRunMessage } = require('../../common/commonHelp');
|
|
7
|
+
const processAudit = async (contrastConf, argvMain) => {
|
|
8
|
+
if (argvMain.indexOf('--help') !== -1) {
|
|
14
9
|
printHelpMessage();
|
|
15
10
|
process.exit(0);
|
|
16
11
|
}
|
|
17
|
-
const config = await
|
|
18
|
-
await
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const config = await auditConfig.getAuditConfig(contrastConf, 'audit', argvMain);
|
|
13
|
+
await scaController.processSca(config);
|
|
14
|
+
if (!config.fingerprint) {
|
|
15
|
+
postRunMessage('audit');
|
|
16
|
+
await sendTelemetryConfigAsObject(config, 'audit', argvMain, 'SUCCESS', config.language);
|
|
17
|
+
}
|
|
21
18
|
};
|
|
22
|
-
exports.processAudit = processAudit;
|
|
23
19
|
const printHelpMessage = () => {
|
|
24
|
-
console.log(
|
|
20
|
+
console.log(auditUsageGuide);
|
|
25
21
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
console.log("'contrast scan' to run CodeSec’s industry leading SAST scanner");
|
|
29
|
-
console.log("'contrast lambda' to secure your AWS serverless functions\n");
|
|
22
|
+
module.exports = {
|
|
23
|
+
processAudit
|
|
30
24
|
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.saveFile = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
2
|
+
const fs = require('fs');
|
|
8
3
|
const saveFile = (config, type, rawResults) => {
|
|
9
4
|
const fileName = `${config.applicationId}-sbom-${type}.json`;
|
|
10
|
-
|
|
5
|
+
fs.writeFileSync(fileName, JSON.stringify(rawResults));
|
|
11
6
|
};
|
|
12
|
-
exports.saveFile = saveFile;
|
|
13
7
|
module.exports = {
|
|
14
|
-
saveFile
|
|
8
|
+
saveFile
|
|
15
9
|
};
|
|
@@ -8,7 +8,7 @@ const i18n = require('i18n');
|
|
|
8
8
|
const { returnOra, startSpinner, failSpinner, succeedSpinner } = require('../../utils/oraWrapper');
|
|
9
9
|
const { TIMEOUT, AUTH_UI_URL } = require('../../constants/constants');
|
|
10
10
|
const parsedCLIOptions = require('../../utils/parsedCLIOptions');
|
|
11
|
-
const constants = require('../../
|
|
11
|
+
const constants = require('../../cliConstants');
|
|
12
12
|
const commandLineUsage = require('command-line-usage');
|
|
13
13
|
const processAuth = async (argv, config) => {
|
|
14
14
|
let authParams = await parsedCLIOptions.getCommandLineArgsCustom(config, 'auth', argv, constants.commandLineDefinitions.authOptionDefinitions);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const parsedCLIOptions = require('../../utils/parsedCLIOptions');
|
|
3
|
-
const constants = require('../../
|
|
3
|
+
const constants = require('../../cliConstants');
|
|
4
4
|
const commandLineUsage = require('command-line-usage');
|
|
5
5
|
const i18n = require('i18n');
|
|
6
6
|
const processConfig = async (argv, config) => {
|
|
@@ -6,7 +6,7 @@ const { ScanResultsModel } = require('../../scan/models/scanResultsModel');
|
|
|
6
6
|
const { formatScanOutput } = require('../../scan/formatScanOutput');
|
|
7
7
|
const common = require('../../common/fail');
|
|
8
8
|
const { sendTelemetryConfigAsObject } = require('../../telemetry/telemetry');
|
|
9
|
-
const
|
|
9
|
+
const { postRunMessage } = require('../../common/commonHelp');
|
|
10
10
|
const processScan = async (contrastConf, argv) => {
|
|
11
11
|
let config = await scanConfig.getScanConfig(contrastConf, 'scan', argv);
|
|
12
12
|
let output = undefined;
|
|
@@ -18,15 +18,13 @@ const processScan = async (contrastConf, argv) => {
|
|
|
18
18
|
if (config.save !== undefined) {
|
|
19
19
|
await saveScanFile(config, scanResults);
|
|
20
20
|
}
|
|
21
|
+
else {
|
|
22
|
+
console.log('\nUse contrast scan --save to save results as a SARIF');
|
|
23
|
+
}
|
|
21
24
|
if (config.fail) {
|
|
22
25
|
common.processFail(config, output);
|
|
23
26
|
}
|
|
24
|
-
postRunMessage();
|
|
25
|
-
};
|
|
26
|
-
const postRunMessage = () => {
|
|
27
|
-
console.log('\n' + chalk.underline.bold('Other Codesec Features:'));
|
|
28
|
-
console.log("'contrast audit' to find vulnerabilities in your open source dependencies");
|
|
29
|
-
console.log("'contrast lambda' to secure your AWS serverless functions\n");
|
|
27
|
+
postRunMessage('scan');
|
|
30
28
|
};
|
|
31
29
|
module.exports = {
|
|
32
30
|
processScan
|