@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/src/cliConstants.js
CHANGED
|
@@ -11,7 +11,7 @@ i18n.configure({
|
|
|
11
11
|
defaultLocale: 'en'
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const sharedCertOptionDefinitions = [
|
|
15
15
|
{
|
|
16
16
|
name: 'proxy',
|
|
17
17
|
description:
|
|
@@ -45,46 +45,55 @@ const sharedOptionDefinitions = [
|
|
|
45
45
|
i18n.__('constantsProxyCert')
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
name: '
|
|
48
|
+
name: 'cert-self-signed',
|
|
49
49
|
type: Boolean,
|
|
50
50
|
description:
|
|
51
51
|
'{bold ' +
|
|
52
52
|
i18n.__('constantsOptional') +
|
|
53
53
|
'}:' +
|
|
54
|
-
i18n.__('
|
|
54
|
+
i18n.__('constantsCertSelfSigned')
|
|
55
55
|
}
|
|
56
56
|
]
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
const scanOptionDefinitions = [
|
|
60
|
-
...sharedOptionDefinitions,
|
|
58
|
+
const sharedConnectionOptionDefinitions = [
|
|
61
59
|
{
|
|
62
|
-
name: '
|
|
63
|
-
alias: '
|
|
60
|
+
name: 'organization-id',
|
|
61
|
+
alias: 'o',
|
|
64
62
|
description:
|
|
65
63
|
'{bold ' +
|
|
66
|
-
i18n.__('
|
|
64
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
67
65
|
'}: ' +
|
|
68
|
-
i18n.__('
|
|
66
|
+
i18n.__('constantsOrganizationId')
|
|
69
67
|
},
|
|
70
68
|
{
|
|
71
|
-
name: '
|
|
72
|
-
alias: 'l',
|
|
69
|
+
name: 'api-key',
|
|
73
70
|
description:
|
|
74
71
|
'{bold ' +
|
|
75
|
-
i18n.__('
|
|
72
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
76
73
|
'}: ' +
|
|
77
|
-
i18n.__('
|
|
74
|
+
i18n.__('constantsApiKey')
|
|
78
75
|
},
|
|
79
76
|
{
|
|
80
|
-
name: '
|
|
81
|
-
alias: 'f',
|
|
77
|
+
name: 'authorization',
|
|
82
78
|
description:
|
|
83
79
|
'{bold ' +
|
|
84
|
-
i18n.__('
|
|
80
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
85
81
|
'}: ' +
|
|
86
|
-
i18n.__('
|
|
82
|
+
i18n.__('constantsAuthorization')
|
|
87
83
|
},
|
|
84
|
+
{
|
|
85
|
+
name: 'host',
|
|
86
|
+
description:
|
|
87
|
+
'{bold ' +
|
|
88
|
+
i18n.__('constantsRequiredEnterprise') +
|
|
89
|
+
'}: ' +
|
|
90
|
+
i18n.__('constantsHostId')
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
const scanAdvancedOptionDefinitionsForHelp = [
|
|
95
|
+
...sharedConnectionOptionDefinitions,
|
|
96
|
+
...sharedCertOptionDefinitions,
|
|
88
97
|
{
|
|
89
98
|
name: 'project-id',
|
|
90
99
|
alias: 'p',
|
|
@@ -95,55 +104,60 @@ const scanOptionDefinitions = [
|
|
|
95
104
|
i18n.__('constantsProjectId')
|
|
96
105
|
},
|
|
97
106
|
{
|
|
98
|
-
name: '
|
|
107
|
+
name: 'language',
|
|
108
|
+
alias: 'l',
|
|
99
109
|
description:
|
|
100
110
|
'{bold ' +
|
|
101
111
|
i18n.__('constantsOptional') +
|
|
102
112
|
'}: ' +
|
|
103
|
-
i18n.__('
|
|
113
|
+
i18n.__('scanOptionsLanguageSummary')
|
|
104
114
|
},
|
|
105
115
|
{
|
|
106
|
-
name: '
|
|
107
|
-
|
|
108
|
-
type: Number,
|
|
116
|
+
name: 'ff',
|
|
117
|
+
type: Boolean,
|
|
109
118
|
description:
|
|
110
119
|
'{bold ' +
|
|
111
120
|
i18n.__('constantsOptional') +
|
|
112
121
|
'}: ' +
|
|
113
|
-
i18n.__('
|
|
122
|
+
i18n.__('constantsDoNotWaitForScan')
|
|
114
123
|
},
|
|
115
124
|
{
|
|
116
|
-
name: '
|
|
117
|
-
alias: 'o',
|
|
125
|
+
name: 'label',
|
|
118
126
|
description:
|
|
119
|
-
'{bold ' +
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
'{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('scanLabel')
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
// CLI options that we will allow and handle
|
|
132
|
+
const scanOptionDefinitions = [
|
|
133
|
+
...scanAdvancedOptionDefinitionsForHelp,
|
|
124
134
|
{
|
|
125
|
-
name: '
|
|
135
|
+
name: 'name',
|
|
136
|
+
alias: 'n',
|
|
126
137
|
description:
|
|
127
138
|
'{bold ' +
|
|
128
|
-
i18n.__('
|
|
139
|
+
i18n.__('constantsOptional') +
|
|
129
140
|
'}: ' +
|
|
130
|
-
i18n.__('
|
|
141
|
+
i18n.__('constantsProjectName')
|
|
131
142
|
},
|
|
132
143
|
{
|
|
133
|
-
name: '
|
|
144
|
+
name: 'file',
|
|
145
|
+
alias: 'f',
|
|
134
146
|
description:
|
|
135
147
|
'{bold ' +
|
|
136
|
-
i18n.__('
|
|
148
|
+
i18n.__('constantsOptional') +
|
|
137
149
|
'}: ' +
|
|
138
|
-
i18n.__('
|
|
150
|
+
i18n.__('scanOptionsFileNameSummary')
|
|
139
151
|
},
|
|
140
152
|
{
|
|
141
|
-
name: '
|
|
153
|
+
name: 'timeout',
|
|
154
|
+
alias: 't',
|
|
155
|
+
type: Number,
|
|
142
156
|
description:
|
|
143
157
|
'{bold ' +
|
|
144
|
-
i18n.__('
|
|
158
|
+
i18n.__('constantsOptional') +
|
|
145
159
|
'}: ' +
|
|
146
|
-
i18n.__('
|
|
160
|
+
i18n.__('scanOptionsTimeoutSummary')
|
|
147
161
|
},
|
|
148
162
|
{
|
|
149
163
|
name: 'fail',
|
|
@@ -163,15 +177,6 @@ const scanOptionDefinitions = [
|
|
|
163
177
|
'}: ' +
|
|
164
178
|
i18n.__('constantsSeverity')
|
|
165
179
|
},
|
|
166
|
-
{
|
|
167
|
-
name: 'ff',
|
|
168
|
-
type: Boolean,
|
|
169
|
-
description:
|
|
170
|
-
'{bold ' +
|
|
171
|
-
i18n.__('constantsOptional') +
|
|
172
|
-
'}: ' +
|
|
173
|
-
i18n.__('constantsDoNotWaitForScan')
|
|
174
|
-
},
|
|
175
180
|
{
|
|
176
181
|
name: 'verbose',
|
|
177
182
|
alias: 'v',
|
|
@@ -188,11 +193,6 @@ const scanOptionDefinitions = [
|
|
|
188
193
|
description:
|
|
189
194
|
'{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('constantsSave')
|
|
190
195
|
},
|
|
191
|
-
{
|
|
192
|
-
name: 'label',
|
|
193
|
-
description:
|
|
194
|
-
'{bold ' + i18n.__('constantsOptional') + '}:' + i18n.__('scanLabel')
|
|
195
|
-
},
|
|
196
196
|
{
|
|
197
197
|
name: 'help',
|
|
198
198
|
alias: 'h',
|
|
@@ -207,14 +207,6 @@ const scanOptionDefinitions = [
|
|
|
207
207
|
name: 'experimental',
|
|
208
208
|
alias: 'e',
|
|
209
209
|
type: Boolean
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: 'application-name',
|
|
213
|
-
description:
|
|
214
|
-
'{bold ' +
|
|
215
|
-
i18n.__('constantsOptional') +
|
|
216
|
-
'}: ' +
|
|
217
|
-
i18n.__('constantsApplicationName')
|
|
218
210
|
}
|
|
219
211
|
]
|
|
220
212
|
|
|
@@ -241,8 +233,9 @@ const configOptionDefinitions = [
|
|
|
241
233
|
}
|
|
242
234
|
]
|
|
243
235
|
|
|
244
|
-
const
|
|
245
|
-
...
|
|
236
|
+
const auditAdvancedOptionDefinitionsForHelp = [
|
|
237
|
+
...sharedConnectionOptionDefinitions,
|
|
238
|
+
...sharedCertOptionDefinitions,
|
|
246
239
|
{
|
|
247
240
|
name: 'application-id',
|
|
248
241
|
description:
|
|
@@ -259,39 +252,11 @@ const auditOptionDefinitions = [
|
|
|
259
252
|
'}: ' +
|
|
260
253
|
i18n.__('constantsApplicationName')
|
|
261
254
|
},
|
|
262
|
-
{
|
|
263
|
-
name: 'file',
|
|
264
|
-
alias: 'f',
|
|
265
|
-
defaultValue: process.cwd().concat('/'),
|
|
266
|
-
description:
|
|
267
|
-
'{bold ' +
|
|
268
|
-
i18n.__('constantsOptional') +
|
|
269
|
-
'}: ' +
|
|
270
|
-
i18n.__('constantsFilePath')
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'fail',
|
|
274
|
-
type: Boolean,
|
|
275
|
-
description:
|
|
276
|
-
'{bold ' +
|
|
277
|
-
i18n.__('constantsOptional') +
|
|
278
|
-
'}: ' +
|
|
279
|
-
i18n.__('failOptionMessage')
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
name: 'severity',
|
|
283
|
-
type: severity => parseSeverity(severity),
|
|
284
|
-
description:
|
|
285
|
-
'{bold ' +
|
|
286
|
-
i18n.__('constantsOptional') +
|
|
287
|
-
'}: ' +
|
|
288
|
-
i18n.__('constantsSeverity')
|
|
289
|
-
},
|
|
290
255
|
{
|
|
291
256
|
name: 'app-groups',
|
|
292
257
|
description:
|
|
293
258
|
'{bold ' +
|
|
294
|
-
i18n.__('
|
|
259
|
+
i18n.__('constantsOptional') +
|
|
295
260
|
'}: ' +
|
|
296
261
|
i18n.__('constantsAppGroups')
|
|
297
262
|
},
|
|
@@ -322,50 +287,58 @@ const auditOptionDefinitions = [
|
|
|
322
287
|
'{bold ' + i18n.__('constantsOptional') + '}: ' + i18n.__('constantsCode')
|
|
323
288
|
},
|
|
324
289
|
{
|
|
325
|
-
name: '
|
|
326
|
-
type: Boolean,
|
|
327
|
-
alias: 'i',
|
|
290
|
+
name: 'maven-settings-path',
|
|
328
291
|
description:
|
|
329
292
|
'{bold ' +
|
|
330
293
|
i18n.__('constantsOptional') +
|
|
331
294
|
'}: ' +
|
|
332
|
-
i18n.__('
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
295
|
+
i18n.__('constantsMavenSettingsPath')
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
const auditOptionDefinitions = [
|
|
300
|
+
...auditAdvancedOptionDefinitionsForHelp,
|
|
337
301
|
{
|
|
338
|
-
name: '
|
|
339
|
-
alias: '
|
|
302
|
+
name: 'file',
|
|
303
|
+
alias: 'f',
|
|
304
|
+
defaultValue: process.cwd().concat('/'),
|
|
340
305
|
description:
|
|
341
306
|
'{bold ' +
|
|
342
|
-
i18n.__('
|
|
307
|
+
i18n.__('constantsOptional') +
|
|
343
308
|
'}: ' +
|
|
344
|
-
i18n.__('
|
|
309
|
+
i18n.__('constantsFilePath')
|
|
345
310
|
},
|
|
346
311
|
{
|
|
347
|
-
name: '
|
|
312
|
+
name: 'fail',
|
|
313
|
+
type: Boolean,
|
|
348
314
|
description:
|
|
349
315
|
'{bold ' +
|
|
350
|
-
i18n.__('
|
|
316
|
+
i18n.__('constantsOptional') +
|
|
351
317
|
'}: ' +
|
|
352
|
-
i18n.__('
|
|
318
|
+
i18n.__('failOptionMessage')
|
|
353
319
|
},
|
|
354
320
|
{
|
|
355
|
-
name: '
|
|
321
|
+
name: 'severity',
|
|
322
|
+
type: severity => parseSeverity(severity),
|
|
356
323
|
description:
|
|
357
324
|
'{bold ' +
|
|
358
|
-
i18n.__('
|
|
325
|
+
i18n.__('constantsOptional') +
|
|
359
326
|
'}: ' +
|
|
360
|
-
i18n.__('
|
|
327
|
+
i18n.__('constantsSeverity')
|
|
361
328
|
},
|
|
362
329
|
{
|
|
363
|
-
name: '
|
|
330
|
+
name: 'ignore-dev',
|
|
331
|
+
type: Boolean,
|
|
332
|
+
alias: 'i',
|
|
364
333
|
description:
|
|
365
334
|
'{bold ' +
|
|
366
|
-
i18n.__('
|
|
335
|
+
i18n.__('constantsOptional') +
|
|
367
336
|
'}: ' +
|
|
368
|
-
i18n.__('
|
|
337
|
+
i18n.__('constantsIgnoreDev')
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: 'fingerprint',
|
|
341
|
+
type: Boolean
|
|
369
342
|
},
|
|
370
343
|
{
|
|
371
344
|
name: 'save',
|
|
@@ -455,13 +428,18 @@ const mainUsageGuide = commandLineUsage([
|
|
|
455
428
|
{ name: i18n.__('helpName'), summary: i18n.__('helpSummary') }
|
|
456
429
|
]
|
|
457
430
|
},
|
|
431
|
+
{
|
|
432
|
+
header: i18n.__('constantsAdvancedOptions'),
|
|
433
|
+
optionList: sharedCertOptionDefinitions
|
|
434
|
+
},
|
|
458
435
|
{
|
|
459
436
|
header: i18n.__('configHeader2'),
|
|
460
437
|
content: [
|
|
461
438
|
{ name: i18n.__('clearHeader'), summary: i18n.__('clearContent') }
|
|
462
439
|
]
|
|
463
440
|
},
|
|
464
|
-
commonHelpLinks()
|
|
441
|
+
commonHelpLinks()[0],
|
|
442
|
+
commonHelpLinks()[1]
|
|
465
443
|
])
|
|
466
444
|
|
|
467
445
|
const mainDefinition = [{ name: 'command', defaultOption: true }]
|
|
@@ -473,6 +451,8 @@ module.exports = {
|
|
|
473
451
|
scanOptionDefinitions,
|
|
474
452
|
auditOptionDefinitions,
|
|
475
453
|
authOptionDefinitions,
|
|
476
|
-
configOptionDefinitions
|
|
454
|
+
configOptionDefinitions,
|
|
455
|
+
scanAdvancedOptionDefinitionsForHelp,
|
|
456
|
+
auditAdvancedOptionDefinitionsForHelp
|
|
477
457
|
}
|
|
478
458
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { getCommandLineArgsCustom } = require('../../utils/parsedCLIOptions')
|
|
2
|
+
const constants = require('../../cliConstants')
|
|
3
|
+
const paramHandler = require('../../utils/paramsUtil/paramHandler')
|
|
4
|
+
|
|
5
|
+
const getAuditConfig = async (contrastConf, command, argv) => {
|
|
6
|
+
const auditParameters = await getCommandLineArgsCustom(
|
|
7
|
+
contrastConf,
|
|
8
|
+
command,
|
|
9
|
+
argv,
|
|
10
|
+
constants.commandLineDefinitions.auditOptionDefinitions
|
|
11
|
+
)
|
|
12
|
+
const paramsAuth = paramHandler.getAuth(auditParameters)
|
|
13
|
+
const javaAgreement = paramHandler.getAgreement()
|
|
14
|
+
return { ...paramsAuth, ...auditParameters, ...javaAgreement }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
getAuditConfig
|
|
19
|
+
}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const catalogue = require('../../audit/catalogueApplication/catalogueApplication')
|
|
2
|
+
const commonApi = require('../../audit/languageAnalysisEngine/commonApi')
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
let appID
|
|
4
|
+
const dealWithNoAppId = async config => {
|
|
5
|
+
let appID
|
|
6
6
|
try {
|
|
7
|
-
// @ts-ignore
|
|
8
7
|
appID = await commonApi.returnAppId(config)
|
|
8
|
+
|
|
9
9
|
if (!appID && config.applicationName) {
|
|
10
|
-
return await catalogueApplication(config)
|
|
10
|
+
return await catalogue.catalogueApplication(config)
|
|
11
11
|
}
|
|
12
|
+
|
|
12
13
|
if (!appID && !config.applicationName) {
|
|
13
|
-
config.applicationName = getAppName(config.file)
|
|
14
|
-
// @ts-ignore
|
|
14
|
+
config.applicationName = getAppName(config.file)
|
|
15
15
|
appID = await commonApi.returnAppId(config)
|
|
16
|
+
|
|
16
17
|
if (!appID) {
|
|
17
|
-
return await catalogueApplication(config)
|
|
18
|
+
return await catalogue.catalogueApplication(config)
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
|
-
} catch (e
|
|
21
|
+
} catch (e) {
|
|
21
22
|
if (e.toString().includes('tunneling socket could not be established')) {
|
|
22
23
|
console.log(e.message.toString())
|
|
23
24
|
console.log(
|
|
@@ -29,7 +30,7 @@ export const dealWithNoAppId = async (config: { [x: string]: string }) => {
|
|
|
29
30
|
return appID
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
const getAppName = file => {
|
|
33
34
|
const last = file.charAt(file.length - 1)
|
|
34
35
|
if (last !== '/') {
|
|
35
36
|
return file.split('/').pop()
|
|
@@ -39,6 +40,10 @@ export const getAppName = (file: string) => {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
const removeLastChar =
|
|
43
|
+
const removeLastChar = str => {
|
|
43
44
|
return str.substring(0, str.length - 1)
|
|
44
45
|
}
|
|
46
|
+
|
|
47
|
+
module.exports = {
|
|
48
|
+
dealWithNoAppId
|
|
49
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const commandLineUsage = require('command-line-usage')
|
|
2
|
+
const i18n = require('i18n')
|
|
3
|
+
const constants = require('../../cliConstants')
|
|
4
|
+
const { commonHelpLinks } = require('../../common/commonHelp')
|
|
5
5
|
|
|
6
6
|
const auditUsageGuide = commandLineUsage([
|
|
7
7
|
{
|
|
@@ -34,9 +34,12 @@ const auditUsageGuide = commandLineUsage([
|
|
|
34
34
|
'authorization',
|
|
35
35
|
'host',
|
|
36
36
|
'proxy',
|
|
37
|
+
'cert',
|
|
38
|
+
'cacert',
|
|
39
|
+
'key',
|
|
37
40
|
'help',
|
|
38
41
|
'ff',
|
|
39
|
-
'
|
|
42
|
+
'cert-self-signed',
|
|
40
43
|
'verbose',
|
|
41
44
|
'debug',
|
|
42
45
|
'experimental',
|
|
@@ -49,10 +52,19 @@ const auditUsageGuide = commandLineUsage([
|
|
|
49
52
|
'app-groups',
|
|
50
53
|
'metadata',
|
|
51
54
|
'track',
|
|
55
|
+
'fingerprint',
|
|
52
56
|
'branch'
|
|
53
57
|
]
|
|
54
58
|
},
|
|
55
|
-
|
|
59
|
+
{
|
|
60
|
+
header: i18n.__('constantsAdvancedOptions'),
|
|
61
|
+
optionList:
|
|
62
|
+
constants.commandLineDefinitions.auditAdvancedOptionDefinitionsForHelp
|
|
63
|
+
},
|
|
64
|
+
commonHelpLinks()[0],
|
|
65
|
+
commonHelpLinks()[1]
|
|
56
66
|
])
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
module.exports = {
|
|
69
|
+
auditUsageGuide
|
|
70
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const auditConfig = require('./auditConfig')
|
|
2
|
+
const { auditUsageGuide } = require('./help')
|
|
3
|
+
const scaController = require('../scan/sca/scaAnalysis')
|
|
4
|
+
const { sendTelemetryConfigAsObject } = require('../../telemetry/telemetry')
|
|
5
|
+
const { postRunMessage } = require('../../common/commonHelp')
|
|
6
|
+
|
|
7
|
+
const processAudit = async (contrastConf, argvMain) => {
|
|
8
|
+
if (argvMain.indexOf('--help') !== -1) {
|
|
9
|
+
printHelpMessage()
|
|
10
|
+
process.exit(0)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const config = await auditConfig.getAuditConfig(
|
|
14
|
+
contrastConf,
|
|
15
|
+
'audit',
|
|
16
|
+
argvMain
|
|
17
|
+
)
|
|
18
|
+
await scaController.processSca(config)
|
|
19
|
+
if (!config.fingerprint) {
|
|
20
|
+
postRunMessage('audit')
|
|
21
|
+
await sendTelemetryConfigAsObject(
|
|
22
|
+
config,
|
|
23
|
+
'audit',
|
|
24
|
+
argvMain,
|
|
25
|
+
'SUCCESS',
|
|
26
|
+
config.language
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const printHelpMessage = () => {
|
|
32
|
+
console.log(auditUsageGuide)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
processAudit
|
|
37
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
const fs = require('fs')
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const saveFile = (config, type, rawResults) => {
|
|
4
4
|
const fileName = `${config.applicationId}-sbom-${type}.json`
|
|
5
5
|
fs.writeFileSync(fileName, JSON.stringify(rawResults))
|
|
6
6
|
}
|
|
@@ -5,7 +5,7 @@ const { ScanResultsModel } = require('../../scan/models/scanResultsModel')
|
|
|
5
5
|
const { formatScanOutput } = require('../../scan/formatScanOutput')
|
|
6
6
|
const common = require('../../common/fail')
|
|
7
7
|
const { sendTelemetryConfigAsObject } = require('../../telemetry/telemetry')
|
|
8
|
-
const
|
|
8
|
+
const { postRunMessage } = require('../../common/commonHelp')
|
|
9
9
|
|
|
10
10
|
const processScan = async (contrastConf, argv) => {
|
|
11
11
|
let config = await scanConfig.getScanConfig(contrastConf, 'scan', argv)
|
|
@@ -26,21 +26,15 @@ const processScan = async (contrastConf, argv) => {
|
|
|
26
26
|
|
|
27
27
|
if (config.save !== undefined) {
|
|
28
28
|
await saveScanFile(config, scanResults)
|
|
29
|
+
} else {
|
|
30
|
+
console.log('\nUse contrast scan --save to save results as a SARIF')
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
if (config.fail) {
|
|
32
34
|
common.processFail(config, output)
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
postRunMessage()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const postRunMessage = () => {
|
|
39
|
-
console.log('\n' + chalk.underline.bold('Other Codesec Features:'))
|
|
40
|
-
console.log(
|
|
41
|
-
"'contrast audit' to find vulnerabilities in your open source dependencies"
|
|
42
|
-
)
|
|
43
|
-
console.log("'contrast lambda' to secure your AWS serverless functions\n")
|
|
37
|
+
postRunMessage('scan')
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
module.exports = {
|