@contrast/contrast 1.0.16 → 1.0.18
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/cliConstants.js +91 -109
- package/dist/commands/audit/auditConfig.js +10 -12
- package/dist/commands/audit/auditController.js +12 -16
- package/dist/commands/audit/help.js +32 -26
- package/dist/commands/audit/processAudit.js +16 -22
- package/dist/commands/audit/saveFile.js +3 -9
- package/dist/commands/scan/processScan.js +5 -7
- package/dist/commands/scan/sca/scaAnalysis.js +105 -88
- package/dist/common/HTTPClient.js +1 -1
- package/dist/common/commonHelp.js +35 -17
- package/dist/common/errorHandling.js +38 -57
- package/dist/common/versionChecker.js +24 -27
- package/dist/constants/constants.js +1 -1
- package/dist/constants/locales.js +20 -91
- package/dist/lambda/help.js +2 -1
- package/dist/lambda/lambda.js +2 -7
- package/dist/scaAnalysis/java/analysis.js +40 -5
- package/dist/scaAnalysis/java/index.js +14 -2
- package/dist/scan/autoDetection.js +26 -3
- package/dist/scan/fileUtils.js +24 -1
- package/dist/scan/help.js +11 -4
- package/dist/scan/saveResults.js +1 -1
- package/dist/utils/commonApi.js +16 -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 +2 -1
- package/src/audit/catalogueApplication/catalogueApplication.js +1 -1
- package/src/cliConstants.js +96 -116
- 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} +19 -7
- package/src/commands/audit/processAudit.js +37 -0
- package/src/commands/audit/{saveFile.ts → saveFile.js} +2 -2
- package/src/commands/scan/processScan.js +4 -10
- package/src/commands/scan/sca/scaAnalysis.js +135 -115
- package/src/common/HTTPClient.js +1 -1
- package/src/common/commonHelp.js +43 -0
- package/src/common/{errorHandling.ts → errorHandling.js} +25 -32
- package/src/common/{versionChecker.ts → versionChecker.js} +15 -10
- package/src/constants/constants.js +1 -1
- package/src/constants/locales.js +23 -129
- package/src/lambda/help.ts +2 -1
- package/src/lambda/lambda.ts +2 -10
- package/src/scaAnalysis/java/analysis.js +43 -10
- package/src/scaAnalysis/java/index.js +19 -2
- package/src/scan/autoDetection.js +34 -3
- package/src/scan/fileUtils.js +29 -1
- package/src/scan/help.js +12 -4
- package/src/scan/saveResults.js +1 -1
- package/src/utils/commonApi.js +19 -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
package/dist/cliConstants.js
CHANGED
|
@@ -10,7 +10,7 @@ i18n.configure({
|
|
|
10
10
|
},
|
|
11
11
|
defaultLocale: 'en'
|
|
12
12
|
});
|
|
13
|
-
const
|
|
13
|
+
const sharedCertOptionDefinitions = [
|
|
14
14
|
{
|
|
15
15
|
name: 'proxy',
|
|
16
16
|
description: '{bold ' +
|
|
@@ -40,40 +40,48 @@ const sharedOptionDefinitions = [
|
|
|
40
40
|
i18n.__('constantsProxyCert')
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
name: '
|
|
43
|
+
name: 'cert-self-signed',
|
|
44
44
|
type: Boolean,
|
|
45
45
|
description: '{bold ' +
|
|
46
46
|
i18n.__('constantsOptional') +
|
|
47
47
|
'}:' +
|
|
48
|
-
i18n.__('
|
|
48
|
+
i18n.__('constantsCertSelfSigned')
|
|
49
49
|
}
|
|
50
50
|
];
|
|
51
|
-
const
|
|
52
|
-
...sharedOptionDefinitions,
|
|
51
|
+
const sharedConnectionOptionDefinitions = [
|
|
53
52
|
{
|
|
54
|
-
name: '
|
|
55
|
-
alias: '
|
|
53
|
+
name: 'organization-id',
|
|
54
|
+
alias: 'o',
|
|
56
55
|
description: '{bold ' +
|
|
57
|
-
i18n.__('
|
|
56
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
58
57
|
'}: ' +
|
|
59
|
-
i18n.__('
|
|
58
|
+
i18n.__('constantsOrganizationId')
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
|
-
name: '
|
|
63
|
-
alias: 'l',
|
|
61
|
+
name: 'api-key',
|
|
64
62
|
description: '{bold ' +
|
|
65
|
-
i18n.__('
|
|
63
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
66
64
|
'}: ' +
|
|
67
|
-
i18n.__('
|
|
65
|
+
i18n.__('constantsApiKey')
|
|
68
66
|
},
|
|
69
67
|
{
|
|
70
|
-
name: '
|
|
71
|
-
alias: 'f',
|
|
68
|
+
name: 'authorization',
|
|
72
69
|
description: '{bold ' +
|
|
73
|
-
i18n.__('
|
|
70
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
74
71
|
'}: ' +
|
|
75
|
-
i18n.__('
|
|
72
|
+
i18n.__('constantsAuthorization')
|
|
76
73
|
},
|
|
74
|
+
{
|
|
75
|
+
name: 'host',
|
|
76
|
+
description: '{bold ' +
|
|
77
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
78
|
+
'}: ' +
|
|
79
|
+
i18n.__('constantsHostId')
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
const scanAdvancedOptionDefinitionsForHelp = [
|
|
83
|
+
...sharedConnectionOptionDefinitions,
|
|
84
|
+
...sharedCertOptionDefinitions,
|
|
77
85
|
{
|
|
78
86
|
name: 'project-id',
|
|
79
87
|
alias: 'p',
|
|
@@ -83,49 +91,52 @@ const scanOptionDefinitions = [
|
|
|
83
91
|
i18n.__('constantsProjectId')
|
|
84
92
|
},
|
|
85
93
|
{
|
|
86
|
-
name: '
|
|
94
|
+
name: 'language',
|
|
95
|
+
alias: 'l',
|
|
87
96
|
description: '{bold ' +
|
|
88
97
|
i18n.__('constantsOptional') +
|
|
89
98
|
'}: ' +
|
|
90
|
-
i18n.__('
|
|
99
|
+
i18n.__('scanOptionsLanguageSummary')
|
|
91
100
|
},
|
|
92
101
|
{
|
|
93
|
-
name: '
|
|
94
|
-
|
|
95
|
-
type: Number,
|
|
102
|
+
name: 'ff',
|
|
103
|
+
type: Boolean,
|
|
96
104
|
description: '{bold ' +
|
|
97
105
|
i18n.__('constantsOptional') +
|
|
98
106
|
'}: ' +
|
|
99
|
-
i18n.__('
|
|
107
|
+
i18n.__('constantsDoNotWaitForScan')
|
|
100
108
|
},
|
|
101
109
|
{
|
|
102
|
-
name: '
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
110
|
+
name: 'label',
|
|
111
|
+
description: '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('scanLabel')
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
const scanOptionDefinitions = [
|
|
115
|
+
...scanAdvancedOptionDefinitionsForHelp,
|
|
109
116
|
{
|
|
110
|
-
name: '
|
|
117
|
+
name: 'name',
|
|
118
|
+
alias: 'n',
|
|
111
119
|
description: '{bold ' +
|
|
112
|
-
i18n.__('
|
|
120
|
+
i18n.__('constantsOptional') +
|
|
113
121
|
'}: ' +
|
|
114
|
-
i18n.__('
|
|
122
|
+
i18n.__('constantsProjectName')
|
|
115
123
|
},
|
|
116
124
|
{
|
|
117
|
-
name: '
|
|
125
|
+
name: 'file',
|
|
126
|
+
alias: 'f',
|
|
118
127
|
description: '{bold ' +
|
|
119
|
-
i18n.__('
|
|
128
|
+
i18n.__('constantsOptional') +
|
|
120
129
|
'}: ' +
|
|
121
|
-
i18n.__('
|
|
130
|
+
i18n.__('scanOptionsFileNameSummary')
|
|
122
131
|
},
|
|
123
132
|
{
|
|
124
|
-
name: '
|
|
133
|
+
name: 'timeout',
|
|
134
|
+
alias: 't',
|
|
135
|
+
type: Number,
|
|
125
136
|
description: '{bold ' +
|
|
126
|
-
i18n.__('
|
|
137
|
+
i18n.__('constantsOptional') +
|
|
127
138
|
'}: ' +
|
|
128
|
-
i18n.__('
|
|
139
|
+
i18n.__('scanOptionsTimeoutSummary')
|
|
129
140
|
},
|
|
130
141
|
{
|
|
131
142
|
name: 'fail',
|
|
@@ -143,14 +154,6 @@ const scanOptionDefinitions = [
|
|
|
143
154
|
'}: ' +
|
|
144
155
|
i18n.__('constantsSeverity')
|
|
145
156
|
},
|
|
146
|
-
{
|
|
147
|
-
name: 'ff',
|
|
148
|
-
type: Boolean,
|
|
149
|
-
description: '{bold ' +
|
|
150
|
-
i18n.__('constantsOptional') +
|
|
151
|
-
'}: ' +
|
|
152
|
-
i18n.__('constantsDoNotWaitForScan')
|
|
153
|
-
},
|
|
154
157
|
{
|
|
155
158
|
name: 'verbose',
|
|
156
159
|
alias: 'v',
|
|
@@ -165,10 +168,6 @@ const scanOptionDefinitions = [
|
|
|
165
168
|
alias: 's',
|
|
166
169
|
description: '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('constantsSave')
|
|
167
170
|
},
|
|
168
|
-
{
|
|
169
|
-
name: 'label',
|
|
170
|
-
description: '{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('scanLabel')
|
|
171
|
-
},
|
|
172
171
|
{
|
|
173
172
|
name: 'help',
|
|
174
173
|
alias: 'h',
|
|
@@ -183,13 +182,6 @@ const scanOptionDefinitions = [
|
|
|
183
182
|
name: 'experimental',
|
|
184
183
|
alias: 'e',
|
|
185
184
|
type: Boolean
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: 'application-name',
|
|
189
|
-
description: '{bold ' +
|
|
190
|
-
i18n.__('constantsOptional') +
|
|
191
|
-
'}: ' +
|
|
192
|
-
i18n.__('constantsApplicationName')
|
|
193
185
|
}
|
|
194
186
|
];
|
|
195
187
|
const authOptionDefinitions = [
|
|
@@ -213,8 +205,9 @@ const configOptionDefinitions = [
|
|
|
213
205
|
description: 'Clear the currently stored config'
|
|
214
206
|
}
|
|
215
207
|
];
|
|
216
|
-
const
|
|
217
|
-
...
|
|
208
|
+
const auditAdvancedOptionDefinitionsForHelp = [
|
|
209
|
+
...sharedConnectionOptionDefinitions,
|
|
210
|
+
...sharedCertOptionDefinitions,
|
|
218
211
|
{
|
|
219
212
|
name: 'application-id',
|
|
220
213
|
description: '{bold ' +
|
|
@@ -229,35 +222,10 @@ const auditOptionDefinitions = [
|
|
|
229
222
|
'}: ' +
|
|
230
223
|
i18n.__('constantsApplicationName')
|
|
231
224
|
},
|
|
232
|
-
{
|
|
233
|
-
name: 'file',
|
|
234
|
-
alias: 'f',
|
|
235
|
-
defaultValue: process.cwd().concat('/'),
|
|
236
|
-
description: '{bold ' +
|
|
237
|
-
i18n.__('constantsOptional') +
|
|
238
|
-
'}: ' +
|
|
239
|
-
i18n.__('constantsFilePath')
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: 'fail',
|
|
243
|
-
type: Boolean,
|
|
244
|
-
description: '{bold ' +
|
|
245
|
-
i18n.__('constantsOptional') +
|
|
246
|
-
'}: ' +
|
|
247
|
-
i18n.__('failOptionMessage')
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
name: 'severity',
|
|
251
|
-
type: severity => parseSeverity(severity),
|
|
252
|
-
description: '{bold ' +
|
|
253
|
-
i18n.__('constantsOptional') +
|
|
254
|
-
'}: ' +
|
|
255
|
-
i18n.__('constantsSeverity')
|
|
256
|
-
},
|
|
257
225
|
{
|
|
258
226
|
name: 'app-groups',
|
|
259
227
|
description: '{bold ' +
|
|
260
|
-
i18n.__('
|
|
228
|
+
i18n.__('constantsOptional') +
|
|
261
229
|
'}: ' +
|
|
262
230
|
i18n.__('constantsAppGroups')
|
|
263
231
|
},
|
|
@@ -284,45 +252,52 @@ const auditOptionDefinitions = [
|
|
|
284
252
|
description: '{bold ' + i18n.__('constantsOptional') + '}: ' + i18n.__('constantsCode')
|
|
285
253
|
},
|
|
286
254
|
{
|
|
287
|
-
name: '
|
|
288
|
-
type: Boolean,
|
|
289
|
-
alias: 'i',
|
|
255
|
+
name: 'maven-settings-path',
|
|
290
256
|
description: '{bold ' +
|
|
291
257
|
i18n.__('constantsOptional') +
|
|
292
258
|
'}: ' +
|
|
293
|
-
i18n.__('
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
259
|
+
i18n.__('constantsMavenSettingsPath')
|
|
260
|
+
}
|
|
261
|
+
];
|
|
262
|
+
const auditOptionDefinitions = [
|
|
263
|
+
...auditAdvancedOptionDefinitionsForHelp,
|
|
298
264
|
{
|
|
299
|
-
name: '
|
|
300
|
-
alias: '
|
|
265
|
+
name: 'file',
|
|
266
|
+
alias: 'f',
|
|
267
|
+
defaultValue: process.cwd().concat('/'),
|
|
301
268
|
description: '{bold ' +
|
|
302
|
-
i18n.__('
|
|
269
|
+
i18n.__('constantsOptional') +
|
|
303
270
|
'}: ' +
|
|
304
|
-
i18n.__('
|
|
271
|
+
i18n.__('constantsFilePath')
|
|
305
272
|
},
|
|
306
273
|
{
|
|
307
|
-
name: '
|
|
274
|
+
name: 'fail',
|
|
275
|
+
type: Boolean,
|
|
308
276
|
description: '{bold ' +
|
|
309
|
-
i18n.__('
|
|
277
|
+
i18n.__('constantsOptional') +
|
|
310
278
|
'}: ' +
|
|
311
|
-
i18n.__('
|
|
279
|
+
i18n.__('failOptionMessage')
|
|
312
280
|
},
|
|
313
281
|
{
|
|
314
|
-
name: '
|
|
282
|
+
name: 'severity',
|
|
283
|
+
type: severity => parseSeverity(severity),
|
|
315
284
|
description: '{bold ' +
|
|
316
|
-
i18n.__('
|
|
285
|
+
i18n.__('constantsOptional') +
|
|
317
286
|
'}: ' +
|
|
318
|
-
i18n.__('
|
|
287
|
+
i18n.__('constantsSeverity')
|
|
319
288
|
},
|
|
320
289
|
{
|
|
321
|
-
name: '
|
|
290
|
+
name: 'ignore-dev',
|
|
291
|
+
type: Boolean,
|
|
292
|
+
alias: 'i',
|
|
322
293
|
description: '{bold ' +
|
|
323
|
-
i18n.__('
|
|
294
|
+
i18n.__('constantsOptional') +
|
|
324
295
|
'}: ' +
|
|
325
|
-
i18n.__('
|
|
296
|
+
i18n.__('constantsIgnoreDev')
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'fingerprint',
|
|
300
|
+
type: Boolean
|
|
326
301
|
},
|
|
327
302
|
{
|
|
328
303
|
name: 'save',
|
|
@@ -406,13 +381,18 @@ const mainUsageGuide = commandLineUsage([
|
|
|
406
381
|
{ name: i18n.__('helpName'), summary: i18n.__('helpSummary') }
|
|
407
382
|
]
|
|
408
383
|
},
|
|
384
|
+
{
|
|
385
|
+
header: i18n.__('constantsAdvancedOptions'),
|
|
386
|
+
optionList: sharedCertOptionDefinitions
|
|
387
|
+
},
|
|
409
388
|
{
|
|
410
389
|
header: i18n.__('configHeader2'),
|
|
411
390
|
content: [
|
|
412
391
|
{ name: i18n.__('clearHeader'), summary: i18n.__('clearContent') }
|
|
413
392
|
]
|
|
414
393
|
},
|
|
415
|
-
commonHelpLinks()
|
|
394
|
+
commonHelpLinks()[0],
|
|
395
|
+
commonHelpLinks()[1]
|
|
416
396
|
]);
|
|
417
397
|
const mainDefinition = [{ name: 'command', defaultOption: true }];
|
|
418
398
|
module.exports = {
|
|
@@ -422,6 +402,8 @@ module.exports = {
|
|
|
422
402
|
scanOptionDefinitions,
|
|
423
403
|
auditOptionDefinitions,
|
|
424
404
|
authOptionDefinitions,
|
|
425
|
-
configOptionDefinitions
|
|
405
|
+
configOptionDefinitions,
|
|
406
|
+
scanAdvancedOptionDefinitionsForHelp,
|
|
407
|
+
auditAdvancedOptionDefinitionsForHelp
|
|
426
408
|
}
|
|
427
409
|
};
|
|
@@ -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 cliConstants_1 = __importDefault(require("../../cliConstants"));
|
|
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 cliConstants_1 = __importDefault(require("../../cliConstants"));
|
|
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',
|
|
@@ -39,9 +34,12 @@ const auditUsageGuide = (0, command_line_usage_1.default)([
|
|
|
39
34
|
'authorization',
|
|
40
35
|
'host',
|
|
41
36
|
'proxy',
|
|
37
|
+
'cert',
|
|
38
|
+
'cacert',
|
|
39
|
+
'key',
|
|
42
40
|
'help',
|
|
43
41
|
'ff',
|
|
44
|
-
'
|
|
42
|
+
'cert-self-signed',
|
|
45
43
|
'verbose',
|
|
46
44
|
'debug',
|
|
47
45
|
'experimental',
|
|
@@ -54,9 +52,17 @@ const auditUsageGuide = (0, command_line_usage_1.default)([
|
|
|
54
52
|
'app-groups',
|
|
55
53
|
'metadata',
|
|
56
54
|
'track',
|
|
55
|
+
'fingerprint',
|
|
57
56
|
'branch'
|
|
58
57
|
]
|
|
59
58
|
},
|
|
60
|
-
|
|
59
|
+
{
|
|
60
|
+
header: i18n.__('constantsAdvancedOptions'),
|
|
61
|
+
optionList: constants.commandLineDefinitions.auditAdvancedOptionDefinitionsForHelp
|
|
62
|
+
},
|
|
63
|
+
commonHelpLinks()[0],
|
|
64
|
+
commonHelpLinks()[1]
|
|
61
65
|
]);
|
|
62
|
-
exports
|
|
66
|
+
module.exports = {
|
|
67
|
+
auditUsageGuide
|
|
68
|
+
};
|
|
@@ -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
|
};
|
|
@@ -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
|