@contrast/contrast 1.0.6 β 1.0.9
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/.prettierignore +0 -6
- package/dist/audit/catalogueApplication/catalogueApplication.js +23 -5
- package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js +10 -19
- package/dist/audit/languageAnalysisEngine/report/commonReportingFunctions.js +98 -37
- package/dist/audit/languageAnalysisEngine/report/models/reportListModel.js +2 -1
- package/dist/audit/languageAnalysisEngine/report/models/reportOutputModel.js +4 -3
- package/dist/audit/languageAnalysisEngine/report/models/severityCountModel.js +3 -0
- package/dist/audit/languageAnalysisEngine/report/reportingFeature.js +87 -19
- package/dist/audit/languageAnalysisEngine/report/utils/reportUtils.js +46 -16
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js +57 -19
- package/dist/audit/save.js +37 -0
- package/dist/commands/audit/auditConfig.js +0 -16
- package/dist/commands/audit/auditController.js +18 -11
- package/dist/commands/audit/help.js +31 -25
- package/dist/commands/audit/processAudit.js +3 -3
- package/dist/commands/audit/saveFile.js +8 -4
- package/dist/commands/scan/sca/scaAnalysis.js +55 -10
- package/dist/common/HTTPClient.js +64 -23
- package/dist/common/errorHandling.js +6 -1
- package/dist/common/versionChecker.js +20 -5
- package/dist/constants/constants.js +7 -2
- package/dist/constants/locales.js +35 -38
- package/dist/constants.js +20 -13
- package/dist/index.js +55 -45
- package/dist/lambda/analytics.js +11 -0
- package/dist/lambda/lambda.js +38 -4
- package/dist/lambda/types.js +13 -0
- package/dist/sbom/generateSbom.js +5 -4
- package/dist/scaAnalysis/common/formatMessage.js +44 -1
- package/dist/scaAnalysis/common/treeUpload.js +4 -6
- package/dist/scaAnalysis/dotnet/analysis.js +43 -0
- package/dist/scaAnalysis/dotnet/index.js +10 -0
- package/dist/scaAnalysis/go/goReadDepFile.js +1 -3
- package/dist/scaAnalysis/java/analysis.js +5 -8
- package/dist/scaAnalysis/java/index.js +2 -2
- package/dist/scaAnalysis/javascript/analysis.js +107 -0
- package/dist/scaAnalysis/javascript/index.js +50 -0
- package/dist/scaAnalysis/php/analysis.js +70 -0
- package/dist/scaAnalysis/php/index.js +17 -0
- package/dist/scaAnalysis/python/analysis.js +42 -0
- package/dist/scaAnalysis/python/index.js +10 -0
- package/dist/scaAnalysis/ruby/analysis.js +218 -0
- package/dist/scaAnalysis/ruby/index.js +10 -0
- package/dist/scan/autoDetection.js +23 -22
- package/dist/scan/fileUtils.js +57 -20
- package/dist/scan/formatScanOutput.js +12 -14
- package/dist/scan/models/groupedResultsModel.js +1 -1
- package/dist/scan/models/scanResultsModel.js +3 -1
- package/dist/scan/populateProjectIdAndProjectName.js +2 -1
- package/dist/scan/scan.js +1 -0
- package/dist/scan/scanConfig.js +8 -3
- package/dist/scan/scanController.js +16 -3
- package/dist/scan/scanResults.js +5 -1
- package/dist/utils/commonApi.js +4 -1
- package/dist/utils/filterProjectPath.js +7 -2
- package/dist/utils/getConfig.js +1 -6
- package/package.json +12 -9
- package/src/audit/catalogueApplication/catalogueApplication.js +28 -7
- package/src/audit/languageAnalysisEngine/getProjectRootFilenames.js +10 -39
- package/src/audit/languageAnalysisEngine/report/commonReportingFunctions.ts +183 -68
- package/src/audit/languageAnalysisEngine/report/models/reportLibraryModel.ts +3 -3
- package/src/audit/languageAnalysisEngine/report/models/reportListModel.ts +18 -11
- package/src/audit/languageAnalysisEngine/report/models/reportOutputModel.ts +11 -5
- package/src/audit/languageAnalysisEngine/report/models/reportSeverityModel.ts +6 -1
- package/src/audit/languageAnalysisEngine/report/models/severityCountModel.ts +4 -0
- package/src/audit/languageAnalysisEngine/report/reportingFeature.ts +86 -32
- package/src/audit/languageAnalysisEngine/report/utils/reportUtils.ts +87 -32
- package/src/audit/languageAnalysisEngine/sendSnapshot.js +69 -20
- package/src/audit/save.js +48 -0
- package/src/commands/audit/auditConfig.ts +0 -25
- package/src/commands/audit/auditController.ts +18 -20
- package/src/commands/audit/help.ts +31 -25
- package/src/commands/audit/processAudit.ts +3 -6
- package/src/commands/audit/saveFile.ts +6 -2
- package/src/commands/scan/processScan.js +0 -1
- package/src/commands/scan/sca/scaAnalysis.js +84 -30
- package/src/common/HTTPClient.js +81 -34
- package/src/common/errorHandling.ts +10 -1
- package/src/common/versionChecker.ts +24 -5
- package/src/constants/constants.js +9 -3
- package/src/constants/locales.js +58 -43
- package/src/constants.js +21 -14
- package/src/index.ts +70 -58
- package/src/lambda/analytics.ts +9 -0
- package/src/lambda/arn.ts +2 -1
- package/src/lambda/lambda.ts +40 -17
- package/src/lambda/types.ts +36 -0
- package/src/lambda/utils.ts +2 -7
- package/src/sbom/generateSbom.ts +2 -2
- package/src/scaAnalysis/common/formatMessage.js +48 -1
- package/src/scaAnalysis/common/treeUpload.js +4 -6
- package/src/scaAnalysis/dotnet/analysis.js +54 -0
- package/src/scaAnalysis/dotnet/index.js +11 -0
- package/src/scaAnalysis/go/goAnalysis.js +2 -3
- package/src/scaAnalysis/go/goReadDepFile.js +1 -3
- package/src/scaAnalysis/java/analysis.js +7 -8
- package/src/scaAnalysis/java/index.js +2 -2
- package/src/scaAnalysis/javascript/analysis.js +126 -0
- package/src/scaAnalysis/javascript/index.js +72 -0
- package/src/scaAnalysis/php/analysis.js +78 -0
- package/src/scaAnalysis/php/index.js +22 -0
- package/src/scaAnalysis/python/analysis.js +49 -0
- package/src/scaAnalysis/python/index.js +11 -0
- package/src/scaAnalysis/ruby/analysis.js +273 -0
- package/src/scaAnalysis/ruby/index.js +11 -0
- package/src/scan/autoDetection.js +24 -26
- package/src/scan/fileUtils.js +60 -20
- package/src/scan/formatScanOutput.ts +14 -15
- package/src/scan/models/groupedResultsModel.ts +3 -3
- package/src/scan/models/resultContentModel.ts +1 -1
- package/src/scan/models/scanResultsModel.ts +5 -2
- package/src/scan/populateProjectIdAndProjectName.js +3 -1
- package/src/scan/scan.ts +1 -0
- package/src/scan/scanConfig.js +7 -5
- package/src/scan/scanController.js +18 -4
- package/src/scan/scanResults.js +10 -0
- package/src/utils/commonApi.js +4 -1
- package/src/utils/filterProjectPath.js +6 -2
- package/src/utils/getConfig.ts +1 -12
- package/dist/audit/AnalysisEngine.js +0 -37
- package/dist/audit/autodetection/autoDetectLanguage.js +0 -32
- package/dist/audit/dotnetAnalysisEngine/index.js +0 -25
- package/dist/audit/dotnetAnalysisEngine/parseLockFileContents.js +0 -35
- package/dist/audit/dotnetAnalysisEngine/parseProjectFileContents.js +0 -15
- package/dist/audit/dotnetAnalysisEngine/readLockFileContents.js +0 -18
- package/dist/audit/dotnetAnalysisEngine/readProjectFileContents.js +0 -14
- package/dist/audit/dotnetAnalysisEngine/sanitizer.js +0 -9
- package/dist/audit/goAnalysisEngine/index.js +0 -17
- package/dist/audit/goAnalysisEngine/parseProjectFileContents.js +0 -164
- package/dist/audit/goAnalysisEngine/readProjectFileContents.js +0 -21
- package/dist/audit/goAnalysisEngine/sanitizer.js +0 -5
- package/dist/audit/javaAnalysisEngine/index.js +0 -34
- package/dist/audit/javaAnalysisEngine/parseMavenProjectFileContents.js +0 -153
- package/dist/audit/javaAnalysisEngine/parseProjectFileContents.js +0 -353
- package/dist/audit/javaAnalysisEngine/readProjectFileContents.js +0 -98
- package/dist/audit/javaAnalysisEngine/sanitizer.js +0 -5
- package/dist/audit/languageAnalysisEngine/checkForMultipleIdentifiedLanguages.js +0 -24
- package/dist/audit/languageAnalysisEngine/checkForMultipleIdentifiedProjectFiles.js +0 -24
- package/dist/audit/languageAnalysisEngine/checkIdentifiedLanguageHasLockFile.js +0 -35
- package/dist/audit/languageAnalysisEngine/checkIdentifiedLanguageHasProjectFile.js +0 -23
- package/dist/audit/languageAnalysisEngine/constants.js +0 -20
- package/dist/audit/languageAnalysisEngine/getIdentifiedLanguageInfo.js +0 -25
- package/dist/audit/languageAnalysisEngine/index.js +0 -39
- package/dist/audit/languageAnalysisEngine/languageAnalysisFactory.js +0 -87
- package/dist/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +0 -150
- package/dist/audit/nodeAnalysisEngine/handleNPMLockFileV2.js +0 -40
- package/dist/audit/nodeAnalysisEngine/index.js +0 -31
- package/dist/audit/nodeAnalysisEngine/parseNPMLockFileContents.js +0 -18
- package/dist/audit/nodeAnalysisEngine/parseYarnLockFileContents.js +0 -18
- package/dist/audit/nodeAnalysisEngine/readNPMLockFileContents.js +0 -17
- package/dist/audit/nodeAnalysisEngine/readProjectFileContents.js +0 -14
- package/dist/audit/nodeAnalysisEngine/readYarnLockFileContents.js +0 -24
- package/dist/audit/nodeAnalysisEngine/sanitizer.js +0 -9
- package/dist/audit/phpAnalysisEngine/index.js +0 -23
- package/dist/audit/phpAnalysisEngine/parseLockFileContents.js +0 -52
- package/dist/audit/phpAnalysisEngine/readLockFileContents.js +0 -13
- package/dist/audit/phpAnalysisEngine/readProjectFileContents.js +0 -16
- package/dist/audit/phpAnalysisEngine/sanitizer.js +0 -5
- package/dist/audit/pythonAnalysisEngine/index.js +0 -25
- package/dist/audit/pythonAnalysisEngine/parsePipfileLockContents.js +0 -17
- package/dist/audit/pythonAnalysisEngine/parseProjectFileContents.js +0 -21
- package/dist/audit/pythonAnalysisEngine/readPipfileLockFileContents.js +0 -13
- package/dist/audit/pythonAnalysisEngine/readPythonProjectFileContents.js +0 -14
- package/dist/audit/pythonAnalysisEngine/sanitizer.js +0 -7
- package/dist/audit/rubyAnalysisEngine/index.js +0 -25
- package/dist/audit/rubyAnalysisEngine/parseGemfileLockContents.js +0 -176
- package/dist/audit/rubyAnalysisEngine/parsedGemfile.js +0 -22
- package/dist/audit/rubyAnalysisEngine/readGemfileContents.js +0 -14
- package/dist/audit/rubyAnalysisEngine/readGemfileLockContents.js +0 -14
- package/dist/audit/rubyAnalysisEngine/sanitizer.js +0 -6
- package/src/audit/AnalysisEngine.js +0 -103
- package/src/audit/autodetection/autoDetectLanguage.ts +0 -40
- package/src/audit/dotnetAnalysisEngine/index.js +0 -26
- package/src/audit/dotnetAnalysisEngine/parseLockFileContents.js +0 -47
- package/src/audit/dotnetAnalysisEngine/parseProjectFileContents.js +0 -29
- package/src/audit/dotnetAnalysisEngine/readLockFileContents.js +0 -30
- package/src/audit/dotnetAnalysisEngine/readProjectFileContents.js +0 -26
- package/src/audit/dotnetAnalysisEngine/sanitizer.js +0 -11
- package/src/audit/goAnalysisEngine/index.js +0 -18
- package/src/audit/goAnalysisEngine/parseProjectFileContents.js +0 -209
- package/src/audit/goAnalysisEngine/readProjectFileContents.js +0 -31
- package/src/audit/goAnalysisEngine/sanitizer.js +0 -7
- package/src/audit/javaAnalysisEngine/index.js +0 -41
- package/src/audit/javaAnalysisEngine/parseMavenProjectFileContents.js +0 -222
- package/src/audit/javaAnalysisEngine/parseProjectFileContents.js +0 -420
- package/src/audit/javaAnalysisEngine/readProjectFileContents.js +0 -141
- package/src/audit/javaAnalysisEngine/sanitizer.js +0 -6
- package/src/audit/languageAnalysisEngine/checkForMultipleIdentifiedLanguages.js +0 -35
- package/src/audit/languageAnalysisEngine/checkForMultipleIdentifiedProjectFiles.js +0 -41
- package/src/audit/languageAnalysisEngine/checkIdentifiedLanguageHasLockFile.js +0 -54
- package/src/audit/languageAnalysisEngine/checkIdentifiedLanguageHasProjectFile.js +0 -32
- package/src/audit/languageAnalysisEngine/constants.js +0 -23
- package/src/audit/languageAnalysisEngine/getIdentifiedLanguageInfo.js +0 -41
- package/src/audit/languageAnalysisEngine/index.js +0 -45
- package/src/audit/languageAnalysisEngine/languageAnalysisFactory.js +0 -116
- package/src/audit/languageAnalysisEngine/reduceIdentifiedLanguages.js +0 -249
- package/src/audit/nodeAnalysisEngine/handleNPMLockFileV2.js +0 -49
- package/src/audit/nodeAnalysisEngine/index.js +0 -35
- package/src/audit/nodeAnalysisEngine/parseNPMLockFileContents.js +0 -20
- package/src/audit/nodeAnalysisEngine/parseYarnLockFileContents.js +0 -26
- package/src/audit/nodeAnalysisEngine/readNPMLockFileContents.js +0 -23
- package/src/audit/nodeAnalysisEngine/readProjectFileContents.js +0 -27
- package/src/audit/nodeAnalysisEngine/readYarnLockFileContents.js +0 -36
- package/src/audit/nodeAnalysisEngine/sanitizer.js +0 -11
- package/src/audit/phpAnalysisEngine/index.js +0 -27
- package/src/audit/phpAnalysisEngine/parseLockFileContents.js +0 -60
- package/src/audit/phpAnalysisEngine/readLockFileContents.js +0 -14
- package/src/audit/phpAnalysisEngine/readProjectFileContents.js +0 -25
- package/src/audit/phpAnalysisEngine/sanitizer.js +0 -4
- package/src/audit/pythonAnalysisEngine/index.js +0 -55
- package/src/audit/pythonAnalysisEngine/parsePipfileLockContents.js +0 -23
- package/src/audit/pythonAnalysisEngine/parseProjectFileContents.js +0 -33
- package/src/audit/pythonAnalysisEngine/readPipfileLockFileContents.js +0 -16
- package/src/audit/pythonAnalysisEngine/readPythonProjectFileContents.js +0 -22
- package/src/audit/pythonAnalysisEngine/sanitizer.js +0 -9
- package/src/audit/rubyAnalysisEngine/index.js +0 -30
- package/src/audit/rubyAnalysisEngine/parseGemfileLockContents.js +0 -215
- package/src/audit/rubyAnalysisEngine/parsedGemfile.js +0 -39
- package/src/audit/rubyAnalysisEngine/readGemfileContents.js +0 -18
- package/src/audit/rubyAnalysisEngine/readGemfileLockContents.js +0 -17
- package/src/audit/rubyAnalysisEngine/sanitizer.js +0 -8
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
const autoDetection = require('../../../scan/autoDetection')
|
|
2
2
|
const javaAnalysis = require('../../../scaAnalysis/java')
|
|
3
3
|
const treeUpload = require('../../../scaAnalysis/common/treeUpload')
|
|
4
|
-
const {
|
|
5
|
-
manualDetectAuditFilesAndLanguages
|
|
6
|
-
} = require('../../../scan/autoDetection')
|
|
7
4
|
const auditController = require('../../audit/auditController')
|
|
8
5
|
const {
|
|
9
|
-
supportedLanguages: { JAVA, GO }
|
|
10
|
-
} = require('../../../
|
|
6
|
+
supportedLanguages: { JAVA, GO, PYTHON, RUBY, JAVASCRIPT, NODE, PHP, DOTNET }
|
|
7
|
+
} = require('../../../constants/constants')
|
|
11
8
|
const goAnalysis = require('../../../scaAnalysis/go/goAnalysis')
|
|
12
|
-
|
|
9
|
+
const phpAnalysis = require('../../../scaAnalysis/php/index')
|
|
10
|
+
const { rubyAnalysis } = require('../../../scaAnalysis/ruby')
|
|
11
|
+
const { pythonAnalysis } = require('../../../scaAnalysis/python')
|
|
12
|
+
const javascriptAnalysis = require('../../../scaAnalysis/javascript')
|
|
13
|
+
const {
|
|
14
|
+
pollForSnapshotCompletition
|
|
15
|
+
} = require('../../../audit/languageAnalysisEngine/sendSnapshot')
|
|
16
|
+
const {
|
|
17
|
+
returnOra,
|
|
18
|
+
startSpinner,
|
|
19
|
+
succeedSpinner
|
|
20
|
+
} = require('../../../utils/oraWrapper')
|
|
21
|
+
const i18n = require('i18n')
|
|
22
|
+
const {
|
|
23
|
+
vulnerabilityReportV2
|
|
24
|
+
} = require('../../../audit/languageAnalysisEngine/report/reportingFeature')
|
|
25
|
+
const auditSave = require('../../../audit/save')
|
|
26
|
+
const { dotNetAnalysis } = require('../../../scaAnalysis/dotnet')
|
|
13
27
|
const processSca = async config => {
|
|
28
|
+
const startTime = performance.now()
|
|
14
29
|
let filesFound
|
|
15
|
-
if (config.
|
|
16
|
-
|
|
30
|
+
if (config.file) {
|
|
31
|
+
config.file = config.file.concat('/')
|
|
32
|
+
filesFound = await autoDetection.autoDetectAuditFilesAndLanguages(
|
|
33
|
+
config.file
|
|
34
|
+
)
|
|
17
35
|
} else {
|
|
18
|
-
filesFound = await autoDetection.autoDetectAuditFilesAndLanguages(
|
|
36
|
+
filesFound = await autoDetection.autoDetectAuditFilesAndLanguages(undefined)
|
|
37
|
+
config.file = process.cwd().concat('/')
|
|
19
38
|
}
|
|
20
39
|
|
|
21
40
|
// files found looks like [ { javascript: [ Array ] } ]
|
|
@@ -28,43 +47,78 @@ const processSca = async config => {
|
|
|
28
47
|
messageToSend = javaAnalysis.javaAnalysis(config, filesFound[0])
|
|
29
48
|
config.language = JAVA
|
|
30
49
|
break
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
case JAVASCRIPT:
|
|
51
|
+
messageToSend = await javascriptAnalysis.jsAnalysis(
|
|
52
|
+
config,
|
|
53
|
+
filesFound[0]
|
|
54
|
+
)
|
|
55
|
+
config.language = NODE
|
|
56
|
+
break
|
|
57
|
+
case PYTHON:
|
|
58
|
+
messageToSend = pythonAnalysis(config, filesFound[0])
|
|
59
|
+
config.language = PYTHON
|
|
60
|
+
break
|
|
61
|
+
case RUBY:
|
|
62
|
+
messageToSend = rubyAnalysis(config, filesFound[0])
|
|
63
|
+
config.language = RUBY
|
|
64
|
+
break
|
|
65
|
+
case 'PHP':
|
|
66
|
+
messageToSend = phpAnalysis.phpAnalysis(config, filesFound[0])
|
|
67
|
+
config.language = PHP
|
|
68
|
+
break
|
|
46
69
|
case GO:
|
|
47
70
|
messageToSend = goAnalysis.goAnalysis(config, filesFound[0])
|
|
48
71
|
config.language = GO
|
|
49
72
|
break
|
|
73
|
+
case DOTNET:
|
|
74
|
+
messageToSend = dotNetAnalysis(config, filesFound[0])
|
|
75
|
+
config.language = DOTNET
|
|
76
|
+
break
|
|
50
77
|
default:
|
|
51
78
|
//something is wrong
|
|
52
|
-
console.log('language detected
|
|
79
|
+
console.log('No supported language detected in project path')
|
|
53
80
|
return
|
|
54
81
|
}
|
|
55
82
|
|
|
56
83
|
if (!config.applicationId) {
|
|
57
84
|
config.applicationId = await auditController.dealWithNoAppId(config)
|
|
58
85
|
}
|
|
86
|
+
|
|
87
|
+
console.log('') //empty log for space before spinner
|
|
59
88
|
//send message to TS
|
|
60
|
-
|
|
61
|
-
|
|
89
|
+
const reportSpinner = returnOra(i18n.__('auditSCAAnalysisBegins'))
|
|
90
|
+
startSpinner(reportSpinner)
|
|
91
|
+
const snapshotResponse = await treeUpload.commonSendSnapShot(
|
|
92
|
+
messageToSend,
|
|
93
|
+
config
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
//poll for completion
|
|
97
|
+
await pollForSnapshotCompletition(
|
|
98
|
+
config,
|
|
99
|
+
snapshotResponse.id,
|
|
100
|
+
reportSpinner
|
|
101
|
+
)
|
|
102
|
+
succeedSpinner(reportSpinner, i18n.__('auditSCAAnalysisComplete'))
|
|
103
|
+
|
|
104
|
+
await vulnerabilityReportV2(config, snapshotResponse.id)
|
|
105
|
+
if (config.save !== undefined) {
|
|
106
|
+
await auditSave.auditSave(config)
|
|
107
|
+
}
|
|
108
|
+
const endTime = performance.now() - startTime
|
|
109
|
+
const scanDurationMs = endTime - startTime
|
|
110
|
+
|
|
111
|
+
console.log(
|
|
112
|
+
`----- completed in ${(scanDurationMs / 1000).toFixed(2)}s -----`
|
|
113
|
+
)
|
|
62
114
|
} else {
|
|
63
115
|
if (filesFound.length === 0) {
|
|
64
|
-
console.log(
|
|
116
|
+
console.log(i18n.__('languageAnalysisNoLanguage'))
|
|
117
|
+
console.log(i18n.__('languageAnalysisNoLanguageHelpLine'))
|
|
118
|
+
throw new Error()
|
|
65
119
|
} else {
|
|
66
|
-
|
|
67
|
-
'multiple language files detected, please use --
|
|
120
|
+
throw new Error(
|
|
121
|
+
'multiple language files detected, please use --file to specify a directory or the file where dependencies are declared'
|
|
68
122
|
)
|
|
69
123
|
}
|
|
70
124
|
}
|
package/src/common/HTTPClient.js
CHANGED
|
@@ -22,7 +22,8 @@ function HTTPClient(config) {
|
|
|
22
22
|
Authorization: authToken,
|
|
23
23
|
'API-Key': apiKey,
|
|
24
24
|
SuperAuthorization: superAuthToken,
|
|
25
|
-
'Super-API-Key': superApiKey
|
|
25
|
+
'Super-API-Key': superApiKey,
|
|
26
|
+
'User-Agent': 'contrast-cli-v2'
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -33,7 +34,7 @@ function HTTPClient(config) {
|
|
|
33
34
|
this.maybeAddCertsToRequest(config)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
HTTPClient.prototype.maybeAddCertsToRequest = function(config) {
|
|
37
|
+
HTTPClient.prototype.maybeAddCertsToRequest = function (config) {
|
|
37
38
|
// cacert
|
|
38
39
|
const caCertFilePath = config.cacert
|
|
39
40
|
if (caCertFilePath) {
|
|
@@ -91,13 +92,30 @@ HTTPClient.prototype.getSpecificScanResult = function getSpecificScanResult(
|
|
|
91
92
|
return requestUtils.sendRequest({ method: 'get', options })
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
HTTPClient.prototype.getSpecificScanResultSarif =
|
|
95
|
+
HTTPClient.prototype.getSpecificScanResultSarif =
|
|
96
|
+
function getSpecificScanResultSarif(config, scanId) {
|
|
97
|
+
const options = _.cloneDeep(this.requestOptions)
|
|
98
|
+
options.url = createRawOutputURL(config, scanId)
|
|
99
|
+
return requestUtils.sendRequest({ method: 'get', options })
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
HTTPClient.prototype.createNewEvent = function createNewEvent(
|
|
95
103
|
config,
|
|
96
|
-
scanId
|
|
104
|
+
scanId,
|
|
105
|
+
newProject
|
|
97
106
|
) {
|
|
98
107
|
const options = _.cloneDeep(this.requestOptions)
|
|
99
|
-
options.url =
|
|
100
|
-
|
|
108
|
+
options.url = createEventCollectorURL(config, scanId)
|
|
109
|
+
|
|
110
|
+
options.body = {
|
|
111
|
+
eventSource: process.env.CODESEC_INVOCATION_ENVIRONMENT,
|
|
112
|
+
trackingProperties: {
|
|
113
|
+
projectNameSource: config.projectNameSource,
|
|
114
|
+
waitedForResults: !config.ff,
|
|
115
|
+
newProject
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return requestUtils.sendRequest({ method: 'post', options })
|
|
101
119
|
}
|
|
102
120
|
|
|
103
121
|
HTTPClient.prototype.getScanId = function getScanId(config, codeArtifactId) {
|
|
@@ -190,9 +208,6 @@ HTTPClient.prototype.catalogueCommand = function catalogueCommand(config) {
|
|
|
190
208
|
}
|
|
191
209
|
|
|
192
210
|
HTTPClient.prototype.sendSnapshot = function sendSnapshot(requestBody, config) {
|
|
193
|
-
if (config.language.toUpperCase() === 'RUBY') {
|
|
194
|
-
//console.log('sendSnapshot requestBody', requestBody.snapshot.ruby)
|
|
195
|
-
}
|
|
196
211
|
const options = _.cloneDeep(this.requestOptions)
|
|
197
212
|
let url = createSnapshotURL(config)
|
|
198
213
|
options.url = url
|
|
@@ -210,17 +225,24 @@ HTTPClient.prototype.getReportById = function getReportById(config, reportId) {
|
|
|
210
225
|
return requestUtils.sendRequest({ method: 'get', options })
|
|
211
226
|
}
|
|
212
227
|
|
|
213
|
-
HTTPClient.prototype.
|
|
228
|
+
HTTPClient.prototype.getReportStatusById = function getReportStatusById(
|
|
214
229
|
config,
|
|
215
|
-
|
|
230
|
+
snapshotId
|
|
216
231
|
) {
|
|
217
232
|
const options = _.cloneDeep(this.requestOptions)
|
|
218
|
-
options.url =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return requestUtils.sendRequest({ method: 'put', options })
|
|
233
|
+
options.url = createSpecificReportStatusURL(config, snapshotId)
|
|
234
|
+
return requestUtils.sendRequest({ method: 'get', options })
|
|
222
235
|
}
|
|
223
236
|
|
|
237
|
+
HTTPClient.prototype.getLibraryVulnerabilities =
|
|
238
|
+
function getLibraryVulnerabilities(config, requestBody) {
|
|
239
|
+
const options = _.cloneDeep(this.requestOptions)
|
|
240
|
+
options.url = createLibraryVulnerabilitiesUrl(config)
|
|
241
|
+
options.body = requestBody
|
|
242
|
+
|
|
243
|
+
return requestUtils.sendRequest({ method: 'put', options })
|
|
244
|
+
}
|
|
245
|
+
|
|
224
246
|
HTTPClient.prototype.getAppId = function getAppId(config) {
|
|
225
247
|
const options = _.cloneDeep(this.requestOptions)
|
|
226
248
|
let url = createAppNameUrl(config)
|
|
@@ -295,17 +317,13 @@ HTTPClient.prototype.getScanResources = async function getScanResources(
|
|
|
295
317
|
return requestUtils.sendRequest({ method: 'get', options })
|
|
296
318
|
}
|
|
297
319
|
|
|
298
|
-
HTTPClient.prototype.getFunctionScanResults =
|
|
299
|
-
config,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
functionArn
|
|
303
|
-
) {
|
|
304
|
-
const url = createScanResultsGetUrl(config, params, scanId, functionArn)
|
|
305
|
-
const options = { ...this.requestOptions, url }
|
|
320
|
+
HTTPClient.prototype.getFunctionScanResults =
|
|
321
|
+
async function getFunctionScanResults(config, params, scanId, functionArn) {
|
|
322
|
+
const url = createScanResultsGetUrl(config, params, scanId, functionArn)
|
|
323
|
+
const options = { ...this.requestOptions, url }
|
|
306
324
|
|
|
307
|
-
|
|
308
|
-
}
|
|
325
|
+
return requestUtils.sendRequest({ method: 'get', options })
|
|
326
|
+
}
|
|
309
327
|
|
|
310
328
|
HTTPClient.prototype.checkLibrary = function checkLibrary(data) {
|
|
311
329
|
const options = _.cloneDeep(this.requestOptions)
|
|
@@ -315,12 +333,33 @@ HTTPClient.prototype.checkLibrary = function checkLibrary(data) {
|
|
|
315
333
|
return requestUtils.sendRequest({ method: 'post', options })
|
|
316
334
|
}
|
|
317
335
|
|
|
318
|
-
HTTPClient.prototype.getSbom = function getSbom(config) {
|
|
336
|
+
HTTPClient.prototype.getSbom = function getSbom(config, type) {
|
|
319
337
|
const options = _.cloneDeep(this.requestOptions)
|
|
320
|
-
options.url =
|
|
338
|
+
options.url = createSbomUrl(config, type)
|
|
321
339
|
return requestUtils.sendRequest({ method: 'get', options })
|
|
322
340
|
}
|
|
323
341
|
|
|
342
|
+
HTTPClient.prototype.getLatestVersion = function getLatestVersion() {
|
|
343
|
+
const options = _.cloneDeep(this.requestOptions)
|
|
344
|
+
options.url =
|
|
345
|
+
'https://pkg.contrastsecurity.com/artifactory/cli/latest-version.txt'
|
|
346
|
+
return requestUtils.sendRequest({ method: 'get', options })
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// analytics
|
|
350
|
+
|
|
351
|
+
HTTPClient.prototype.postAnalyticsFunction = function (config, provider, body) {
|
|
352
|
+
const url = createAnalyticsFunctionPostUrl(config, provider)
|
|
353
|
+
const options = { ...this.requestOptions, body, url }
|
|
354
|
+
|
|
355
|
+
return requestUtils.sendRequest({ method: 'post', options })
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const createAnalyticsFunctionPostUrl = (config, provider) => {
|
|
359
|
+
const url = getServerlessHost(config)
|
|
360
|
+
return `${url}/organizations/${config.organizationId}/providers/${provider}/analytics`
|
|
361
|
+
}
|
|
362
|
+
|
|
324
363
|
// scan
|
|
325
364
|
const createGetScanIdURL = config => {
|
|
326
365
|
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}/scans/`
|
|
@@ -350,6 +389,10 @@ function createScanProjectUrl(config) {
|
|
|
350
389
|
return `${config.host}/Contrast/api/sast/v1/organizations/${config.organizationId}/projects/${config.projectId}`
|
|
351
390
|
}
|
|
352
391
|
|
|
392
|
+
const createEventCollectorURL = (config, scanId) => {
|
|
393
|
+
return `${config.host}/Contrast/api/sast/organizations/${config.organizationId}/projects/${config.projectId}/scans/${scanId}/events`
|
|
394
|
+
}
|
|
395
|
+
|
|
353
396
|
const createGlobalPropertiesUrl = protocol => {
|
|
354
397
|
return `${protocol}/Contrast/api/ng/global/properties`
|
|
355
398
|
}
|
|
@@ -374,22 +417,26 @@ function createLibraryVulnerabilitiesUrl(config) {
|
|
|
374
417
|
return `${config.host}/Contrast/api/ng/${config.organizationId}/libraries/artifactsByGroupNameVersion`
|
|
375
418
|
}
|
|
376
419
|
|
|
377
|
-
function createSpecificReportUrl(config, reportId) {
|
|
378
|
-
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/reports/${reportId}`
|
|
420
|
+
function createSpecificReportUrl(config, reportId, includeTree = false) {
|
|
421
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/reports/${reportId}?&includeTree=${includeTree}`
|
|
379
422
|
}
|
|
380
423
|
|
|
381
|
-
function createSpecificReportWithProdUrl(config, reportId) {
|
|
382
|
-
return createSpecificReportUrl(config, reportId).concat(
|
|
383
|
-
|
|
424
|
+
function createSpecificReportWithProdUrl(config, reportId, includeTree) {
|
|
425
|
+
return createSpecificReportUrl(config, reportId, includeTree).concat(
|
|
426
|
+
`&nodesToInclude=PROD`
|
|
384
427
|
)
|
|
385
428
|
}
|
|
386
429
|
|
|
430
|
+
function createSpecificReportStatusURL(config, reportId) {
|
|
431
|
+
return `${config.host}/Contrast/api/ng/sca/organizations/${config.organizationId}/applications/${config.applicationId}/snapshots/${reportId}/status`
|
|
432
|
+
}
|
|
433
|
+
|
|
387
434
|
function createDataUrl() {
|
|
388
435
|
return `https://ardy.contrastsecurity.com/production`
|
|
389
436
|
}
|
|
390
437
|
|
|
391
|
-
function
|
|
392
|
-
return `${config.host}/Contrast/api/ng/${config.organizationId}/applications/${config.applicationId}/libraries/sbom
|
|
438
|
+
function createSbomUrl(config, type) {
|
|
439
|
+
return `${config.host}/Contrast/api/ng/${config.organizationId}/applications/${config.applicationId}/libraries/sbom/${type}`
|
|
393
440
|
}
|
|
394
441
|
|
|
395
442
|
module.exports = HTTPClient
|
|
@@ -64,6 +64,14 @@ const proxyError = () => {
|
|
|
64
64
|
generalError('proxyErrorHeader', 'proxyErrorMessage')
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
const maxAppError = () => {
|
|
68
|
+
generalError(
|
|
69
|
+
'No applications remaining',
|
|
70
|
+
'You have reached the maximum number of application you can create.'
|
|
71
|
+
)
|
|
72
|
+
process.exit(1)
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
const failOptionError = () => {
|
|
68
76
|
console.log(
|
|
69
77
|
'\n ******************************** ' +
|
|
@@ -140,5 +148,6 @@ export {
|
|
|
140
148
|
findCommandOnError,
|
|
141
149
|
snapshotFailureError,
|
|
142
150
|
vulnerabilitiesFailureError,
|
|
143
|
-
reportFailureError
|
|
151
|
+
reportFailureError,
|
|
152
|
+
maxAppError
|
|
144
153
|
}
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
import latestVersion from 'latest-version'
|
|
2
1
|
import { APP_VERSION } from '../constants/constants'
|
|
3
2
|
import boxen from 'boxen'
|
|
4
3
|
import chalk from 'chalk'
|
|
5
4
|
import semver from 'semver'
|
|
5
|
+
import commonApi from '../utils/commonApi'
|
|
6
|
+
import { constants } from 'http2'
|
|
7
|
+
import { ContrastConf } from '../utils/getConfig'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const getLatestVersion = async (config: any) => {
|
|
10
|
+
const client = commonApi.getHttpClient(config)
|
|
11
|
+
try {
|
|
12
|
+
const res = await client.getLatestVersion()
|
|
13
|
+
if (res.statusCode === constants.HTTP_STATUS_OK) {
|
|
14
|
+
return res.body
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
export async function findLatestCLIVersion(config: ContrastConf) {
|
|
23
|
+
const messageHidden = config.get('updateMessageHidden') as boolean
|
|
24
|
+
|
|
25
|
+
if (!messageHidden) {
|
|
26
|
+
let latestCLIVersion: string = await getLatestVersion(config)
|
|
27
|
+
//strip key
|
|
28
|
+
latestCLIVersion = latestCLIVersion.substring(8)
|
|
10
29
|
|
|
11
30
|
if (semver.lt(APP_VERSION, latestCLIVersion)) {
|
|
12
31
|
const updateAvailableMessage = `Update available ${chalk.yellow(
|
|
@@ -37,5 +56,5 @@ export async function findLatestCLIVersion(updateMessageHidden: boolean) {
|
|
|
37
56
|
}
|
|
38
57
|
|
|
39
58
|
export async function isCorrectNodeVersion(currentVersion: string) {
|
|
40
|
-
return semver.satisfies(currentVersion, '>=16
|
|
59
|
+
return semver.satisfies(currentVersion, '>=16')
|
|
41
60
|
}
|
|
@@ -5,15 +5,16 @@ const JAVA = 'JAVA'
|
|
|
5
5
|
const RUBY = 'RUBY'
|
|
6
6
|
const PYTHON = 'PYTHON'
|
|
7
7
|
const GO = 'GO'
|
|
8
|
-
// we set the langauge as Node instead of PHP since we're using the Node engine in TS
|
|
9
8
|
const PHP = 'PHP'
|
|
10
9
|
const JAVASCRIPT = 'JAVASCRIPT'
|
|
10
|
+
// Severity
|
|
11
11
|
const LOW = 'LOW'
|
|
12
12
|
const MEDIUM = 'MEDIUM'
|
|
13
13
|
const HIGH = 'HIGH'
|
|
14
14
|
const CRITICAL = 'CRITICAL'
|
|
15
|
+
// App
|
|
15
16
|
const APP_NAME = 'contrast'
|
|
16
|
-
const APP_VERSION = '1.0.
|
|
17
|
+
const APP_VERSION = '1.0.9'
|
|
17
18
|
const TIMEOUT = 120000
|
|
18
19
|
const HIGH_COLOUR = '#ff9900'
|
|
19
20
|
const CRITICAL_COLOUR = '#e35858'
|
|
@@ -29,10 +30,13 @@ const NOTE_PRIORITY = 5
|
|
|
29
30
|
const AUTH_UI_URL = 'https://cli-auth.contrastsecurity.com'
|
|
30
31
|
const AUTH_CALLBACK_URL = 'https://cli-auth-api.contrastsecurity.com'
|
|
31
32
|
const SARIF_FILE = 'SARIF'
|
|
33
|
+
const SBOM_CYCLONE_DX_FILE = 'cyclonedx'
|
|
34
|
+
const SBOM_SPDX_FILE = 'spdx'
|
|
32
35
|
const CE_URL = 'https://ce.contrastsecurity.com/'
|
|
33
36
|
|
|
34
37
|
module.exports = {
|
|
35
38
|
supportedLanguages: { NODE, DOTNET, JAVA, RUBY, PYTHON, GO, PHP, JAVASCRIPT },
|
|
39
|
+
supportedLanguagesScan: { JAVASCRIPT, DOTNET, JAVA },
|
|
36
40
|
LOW,
|
|
37
41
|
MEDIUM,
|
|
38
42
|
HIGH,
|
|
@@ -53,5 +57,7 @@ module.exports = {
|
|
|
53
57
|
HIGH_PRIORITY,
|
|
54
58
|
MEDIUM_PRIORITY,
|
|
55
59
|
LOW_PRIORITY,
|
|
56
|
-
NOTE_PRIORITY
|
|
60
|
+
NOTE_PRIORITY,
|
|
61
|
+
SBOM_CYCLONE_DX_FILE,
|
|
62
|
+
SBOM_SPDX_FILE
|
|
57
63
|
}
|
package/src/constants/locales.js
CHANGED
|
@@ -15,7 +15,7 @@ const en_locales = () => {
|
|
|
15
15
|
catchErrorMessage: 'Contrast UI error: ',
|
|
16
16
|
dependenciesNote:
|
|
17
17
|
'Please Note: We currently only support projects with one .csproj AND *.package.lock.json',
|
|
18
|
-
languageAnalysisFailureMessage: 'SCA
|
|
18
|
+
languageAnalysisFailureMessage: 'SCA audit Failure',
|
|
19
19
|
languageAnalysisFactoryFailureHeader: 'FAIL',
|
|
20
20
|
libraryAnalysisError:
|
|
21
21
|
'Please ensure the language parameter is set in accordance to the language specified on the project path.\nContrast CLI must be run in the same directory as the project manifest file OR the project_path parameter must be used to identify the directory containing the project manifest file.\n\nFor further information please read our usage guide, which can be accessed with the following command:\n\ncontrast-cli --help',
|
|
@@ -53,8 +53,10 @@ const en_locales = () => {
|
|
|
53
53
|
"Identified project language as '%s' but found multiple project files: %s. Please specify which project file you would like analyzed with the %s CLI option.",
|
|
54
54
|
languageAnalysisHasNoLockFile:
|
|
55
55
|
"Identified project language as '%s' but no project lock file was found.",
|
|
56
|
+
languageAnalysisHasNoPackageJsonFile:
|
|
57
|
+
'Identified project language as javascript but no package.json file was found.',
|
|
56
58
|
languageAnalysisHasMultipleLockFiles:
|
|
57
|
-
"Identified project language as '%s' but multiple project lock files were found
|
|
59
|
+
"Identified project language as '%s' but multiple project lock files were found.",
|
|
58
60
|
languageAnalysisProjectFileError:
|
|
59
61
|
"Identified project language as '%s' but no project file was found.",
|
|
60
62
|
languageAnalysisProjectRootFileNameReadError:
|
|
@@ -64,17 +66,20 @@ const en_locales = () => {
|
|
|
64
66
|
languageAnalysisProjectRootFileNameFailure:
|
|
65
67
|
'Failed to get information about the file or directory @ %s because: ',
|
|
66
68
|
languageAnalysisFailure: ' analysis failed because: ',
|
|
67
|
-
languageAnalysisNoLanguage:
|
|
69
|
+
languageAnalysisNoLanguage:
|
|
70
|
+
'We cannot detect a project, use --f <path> to specify a file or folder to analyze.',
|
|
71
|
+
languageAnalysisNoLanguageHelpLine: `${chalk.bold(
|
|
72
|
+
'contrast audit --help'
|
|
73
|
+
)} for more information.`,
|
|
68
74
|
NodeAnalysisFailure: 'NODE analysis failed because: ',
|
|
69
75
|
phpAnalysisFailure: 'PHP analysis failed because: ',
|
|
70
|
-
NodeParseNPM:
|
|
71
|
-
"Failed to parse NODE package-lock.json file @ '%s' because: ",
|
|
76
|
+
NodeParseNPM: 'Failed to parse NODE package-lock.json file because: ',
|
|
72
77
|
phpParseComposerLock:
|
|
73
78
|
"Failed to parse PHP composer.lock file @ '%s' because: ",
|
|
74
79
|
NodeReadNpmError:
|
|
75
80
|
'Failed to read the package-lock.json file @ "%s" because: ',
|
|
76
81
|
phpReadError: 'Failed to read the composer.lock file @ "%s" because: ',
|
|
77
|
-
NodeParseYarn:
|
|
82
|
+
NodeParseYarn: 'Failed to parse yarn.lock version %s because: ',
|
|
78
83
|
NodeParseYarn2: "Failed to parse Node yarn.lock version 2 @ '%s' because: ",
|
|
79
84
|
nodeReadProjectFileError:
|
|
80
85
|
'Failed to read the NODE project file @ "%s" because: ',
|
|
@@ -118,8 +123,7 @@ const en_locales = () => {
|
|
|
118
123
|
'Provide this if you want to catalogue an application',
|
|
119
124
|
constantsLanguage:
|
|
120
125
|
'Valid values are JAVA, DOTNET, NODE, PYTHON and RUBY. If there are multiple project configuration files in the project_path, language is also required. Also, provide this when cataloguing an application',
|
|
121
|
-
|
|
122
|
-
'The directory root of a project/application that you would like analyzed. Defaults to current directory.',
|
|
126
|
+
constantsFilePath: `Path of the file you want to perform an SCA audit on. If no folder is specified, Contrast searches for dependency files in the working directory.`,
|
|
123
127
|
constantsSilent: 'Silences JSON output.',
|
|
124
128
|
constantsAppGroups:
|
|
125
129
|
'Assign your application to one or more pre-existing groups when using the catalogue command. Group lists should be comma separated.',
|
|
@@ -137,16 +141,17 @@ const en_locales = () => {
|
|
|
137
141
|
'The ID associated with a scan project. Replace <ProjectID> with the ID for the scan project. To find the ID, select a scan project in Contrast and locate the last number in the URL.',
|
|
138
142
|
constantsReport: 'Display vulnerability information for this application',
|
|
139
143
|
constantsFail:
|
|
140
|
-
'Set the process to fail if this option is set in combination with
|
|
144
|
+
'Set the process to fail if this option is set in combination with --cve_severity.',
|
|
141
145
|
failOptionErrorMessage:
|
|
142
|
-
|
|
146
|
+
' FAIL - CVEs have been detected that match at least the cve_severity or cve_threshold option specified.',
|
|
143
147
|
constantsSeverity:
|
|
144
|
-
'
|
|
145
|
-
constantsCount:
|
|
148
|
+
'Allows the user to report libraries with vulnerabilities above a chosen severity level. For example, cve_severity medium only reports libraries with vulnerabilities at medium or higher severity. Values for level are high, medium or low.',
|
|
149
|
+
constantsCount: 'The number of CVEs that must be exceeded to fail a build',
|
|
146
150
|
constantsHeader: 'CodeSec by Contrast Security',
|
|
147
|
-
constantsPrerequisitesContentScanLanguages:
|
|
151
|
+
constantsPrerequisitesContentScanLanguages:
|
|
152
|
+
'Java, Javascript and .NET supported',
|
|
148
153
|
constantsContrastContent:
|
|
149
|
-
|
|
154
|
+
"Use the 'contrast' command for fast and accurate security analysis of your applications and APIs (Java, JavaScript and .NET ) as well as serverless functions (AWS lambda, Java and Python).",
|
|
150
155
|
constantsUsageGuideContentRecommendation:
|
|
151
156
|
'Our recommendation is that this is invoked as part of a CI pipeline so that running the cli is automated as part of your build process.',
|
|
152
157
|
constantsPrerequisitesHeader: 'Pre-requisites',
|
|
@@ -249,7 +254,7 @@ const en_locales = () => {
|
|
|
249
254
|
scanLabel:
|
|
250
255
|
"adds a label to the scan - defaults to 'Started by CLI tool at current date'",
|
|
251
256
|
constantsIgnoreDev:
|
|
252
|
-
'
|
|
257
|
+
'Excludes developer dependencies from the results. All dependencies are included by default.',
|
|
253
258
|
constantsCommands: 'Commands',
|
|
254
259
|
constantsScanOptions: 'Scan Options',
|
|
255
260
|
sbomError: 'All required parameters are not present.',
|
|
@@ -356,6 +361,7 @@ const en_locales = () => {
|
|
|
356
361
|
scanZipError:
|
|
357
362
|
'A .zip archive can be used for Javascript Scan. Archive found %s does not contain .JS files for Scan.',
|
|
358
363
|
fileNotExist: 'File specified does not exist, please check and try again.',
|
|
364
|
+
scanFileIsEmpty: 'File specified is empty. Please choose another.',
|
|
359
365
|
fileHasWhiteSpacesError:
|
|
360
366
|
'File cannot have spaces, please rename or choose another file to Scan.',
|
|
361
367
|
zipFileException: 'Error reading zip file',
|
|
@@ -363,41 +369,49 @@ const en_locales = () => {
|
|
|
363
369
|
'An error has occurred when trying to get the Project Id please check your internet connection or provide the Project Id manually',
|
|
364
370
|
internalServerErrorHeader: '500 error - Internal server error',
|
|
365
371
|
resourceLockedErrorHeader: '423 error - Resource is locked',
|
|
366
|
-
auditHeader: 'Contrast
|
|
367
|
-
auditHeaderMessage:
|
|
368
|
-
|
|
369
|
-
Our recommendation is that this is invoked as part of a CI pipeline so that running the cli is automated as part of your build process.`,
|
|
372
|
+
auditHeader: 'Contrast audit help',
|
|
373
|
+
auditHeaderMessage:
|
|
374
|
+
"Use 'contrast audit' to analyze a projectβs dependencies for vulnerabilities.",
|
|
370
375
|
constantsAuditPrerequisitesContentSupportedLanguages:
|
|
371
376
|
'Supported languages and their requirements are:',
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
377
|
+
constantsAuditPrerequisitesJavaContentMessage: `
|
|
378
|
+
${chalk.bold('Java:')} pom.xml ${chalk.bold(
|
|
379
|
+
'and'
|
|
380
|
+
)} Maven build platform including the dependency plugin.
|
|
381
|
+
${chalk.bold('Or')} build.gradle ${chalk.bold(
|
|
382
|
+
'and'
|
|
383
|
+
)} gradle dependencies or ./gradlew dependencies must be supported`,
|
|
378
384
|
constantsAuditPrerequisitesContentDotNetMessage: `
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
'
|
|
388
|
-
|
|
389
|
-
|
|
385
|
+
${chalk.bold(
|
|
386
|
+
'.NET framework and .NET core:'
|
|
387
|
+
)} MSBuild 15.0 or greater and a packages.lock.json file.
|
|
388
|
+
Note: If the packages.lock.json file is unavailable it can be generated by setting RestorePackagesWithLockFile to true within each *.csproj file and running dotnet build.\n`,
|
|
389
|
+
constantsAuditPrerequisitesContentNodeMessage: `${chalk.bold(
|
|
390
|
+
'Node:'
|
|
391
|
+
)} package.json and a lock file (either .package-lock.json or .yarn.lock.)\n`,
|
|
392
|
+
constantsAuditPrerequisitesContentRubyMessage: `${chalk.bold(
|
|
393
|
+
'Ruby:'
|
|
394
|
+
)} gemfile and gemfile.lock\n`,
|
|
395
|
+
constantsAuditPrerequisitesContentPythonMessage: `${chalk.bold(
|
|
396
|
+
'Python:'
|
|
397
|
+
)} pipfile and pipfile.lock\n`,
|
|
398
|
+
constantsAuditPrerequisitesContentGoMessage: `${chalk.bold(
|
|
399
|
+
'Go:'
|
|
400
|
+
)} go.mod\n`,
|
|
401
|
+
constantsAuditPrerequisitesContentPHPMessage: `${chalk.bold(
|
|
402
|
+
'PHP:'
|
|
403
|
+
)} composer.json and composer.lock\n`,
|
|
390
404
|
constantsAuditOptions: 'Audit Options',
|
|
391
|
-
auditOptionsIgnoreDevDependencies: '-igd, --ignore-dev',
|
|
392
|
-
auditOptionsIgnoreDevDependenciesDescription: 'ignores DevDependencies',
|
|
393
|
-
auditOptionsSave: '-s, --save',
|
|
394
405
|
auditOptionsSaveDescription:
|
|
395
|
-
'
|
|
406
|
+
'Generate and save an SBOM (Software Bill of Materials)\n',
|
|
407
|
+
auditOptionsSaveOptionsDescription:
|
|
408
|
+
'Valid options are: spdx, cyclonedx (cycloneDX is the default format)',
|
|
396
409
|
scanNotCompleted:
|
|
397
410
|
'Scan not completed. Check for framework and language support here: %s',
|
|
398
|
-
|
|
411
|
+
auditNotCompleted: 'audit not completed. Please try again',
|
|
412
|
+
scanNoVulnerabilitiesFound: 'π No vulnerabilities found.',
|
|
399
413
|
scanNoVulnerabilitiesFoundSecureCode: 'π Your code looks secure.',
|
|
400
|
-
scanNoVulnerabilitiesFoundGoodWork: '
|
|
414
|
+
scanNoVulnerabilitiesFoundGoodWork: ' Keep up the good work.',
|
|
401
415
|
scanNoFiletypeSpecifiedForSave:
|
|
402
416
|
'Please specify file type to save results to, accepted value is SARIF',
|
|
403
417
|
auditSBOMSaveSuccess:
|
|
@@ -412,7 +426,8 @@ const en_locales = () => {
|
|
|
412
426
|
auditReportFail: 'Report Retrieval Failed, please try again',
|
|
413
427
|
auditReportSuccessMessage: 'Report successfully retrieved',
|
|
414
428
|
auditReportFailureMessage: 'Unable to generate library report',
|
|
415
|
-
auditSCAAnalysisBegins: 'Contrast SCA
|
|
429
|
+
auditSCAAnalysisBegins: 'Contrast SCA audit started',
|
|
430
|
+
auditSCAAnalysisComplete: 'Contrast audit complete',
|
|
416
431
|
...lambda
|
|
417
432
|
}
|
|
418
433
|
}
|